mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Auto merge of #380 - untitaker:os-x, r=untitaker
Test against OS X (PR) Fixes #379
This commit is contained in:
commit
a2ec405fd0
5 changed files with 56 additions and 30 deletions
14
.travis.yml
14
.travis.yml
|
|
@ -4,16 +4,7 @@ sudo: true
|
||||||
language: python
|
language: python
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then
|
- ". scripts/travis-install.sh"
|
||||||
git clone https://github.com/yyuu/pyenv.git ~/.pyenv;
|
|
||||||
PYENV_ROOT="$HOME/.pyenv";
|
|
||||||
PATH="$PYENV_ROOT/bin:$PATH";
|
|
||||||
eval "$(pyenv init -)";
|
|
||||||
pyenv install pypy-4.0.1;
|
|
||||||
pyenv global pypy-4.0.1;
|
|
||||||
python --version;
|
|
||||||
pip --version;
|
|
||||||
fi
|
|
||||||
- "pip install -U pip"
|
- "pip install -U pip"
|
||||||
- "pip install wheel"
|
- "pip install wheel"
|
||||||
- "make -e install-dev"
|
- "make -e install-dev"
|
||||||
|
|
@ -112,6 +103,9 @@ matrix:
|
||||||
env: BUILD=test DAV_SERVER=radicale REQUIREMENTS=release
|
env: BUILD=test DAV_SERVER=radicale REQUIREMENTS=release
|
||||||
- python: pypy
|
- python: pypy
|
||||||
env: BUILD=test DAV_SERVER=radicale REQUIREMENTS=minimal
|
env: BUILD=test DAV_SERVER=radicale REQUIREMENTS=minimal
|
||||||
|
- language: generic
|
||||||
|
os: osx
|
||||||
|
env: BUILD=test
|
||||||
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
|
|
|
||||||
|
|
@ -25,21 +25,7 @@ p("language: python")
|
||||||
p("")
|
p("")
|
||||||
|
|
||||||
with section("install"):
|
with section("install"):
|
||||||
# Travis uses an outdated PyPy, this installs the most recent one. This
|
p('- ". scripts/travis-install.sh"')
|
||||||
# makes the tests run on Travis' legacy infrastructure, but so be it.
|
|
||||||
# temporary pyenv installation to get pypy-2.6 before container infra
|
|
||||||
# upgrade
|
|
||||||
# Taken from werkzeug, which took it from pyca/cryptography
|
|
||||||
p('- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then')
|
|
||||||
p(' git clone https://github.com/yyuu/pyenv.git ~/.pyenv;')
|
|
||||||
p(' PYENV_ROOT="$HOME/.pyenv";')
|
|
||||||
p(' PATH="$PYENV_ROOT/bin:$PATH";')
|
|
||||||
p(' eval "$(pyenv init -)";')
|
|
||||||
p(' pyenv install pypy-4.0.1;')
|
|
||||||
p(' pyenv global pypy-4.0.1;')
|
|
||||||
p(' python --version;')
|
|
||||||
p(' pip --version;')
|
|
||||||
p(' fi')
|
|
||||||
|
|
||||||
p('- "pip install -U pip"')
|
p('- "pip install -U pip"')
|
||||||
p('- "pip install wheel"')
|
p('- "pip install wheel"')
|
||||||
|
|
@ -79,6 +65,10 @@ with section("matrix"):
|
||||||
server=server,
|
server=server,
|
||||||
requirements=requirements))
|
requirements=requirements))
|
||||||
|
|
||||||
|
p("- language: generic")
|
||||||
|
p(" os: osx")
|
||||||
|
p(" env: BUILD=test")
|
||||||
|
|
||||||
with section("branches"):
|
with section("branches"):
|
||||||
with section("only"):
|
with section("only"):
|
||||||
p('- auto')
|
p('- auto')
|
||||||
|
|
|
||||||
26
scripts/travis-install.sh
Normal file
26
scripts/travis-install.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Travis uses an outdated PyPy, this installs the most recent one. This
|
||||||
|
# makes the tests run on Travis' legacy infrastructure, but so be it.
|
||||||
|
# temporary pyenv installation to get pypy-2.6 before container infra
|
||||||
|
# upgrade
|
||||||
|
# Taken from werkzeug, which took it from pyca/cryptography
|
||||||
|
if [ "$TRAVIS_PYTHON_VERSION" = "pypy" ]; then
|
||||||
|
git clone https://github.com/yyuu/pyenv.git ~/.pyenv;
|
||||||
|
PYENV_ROOT="$HOME/.pyenv";
|
||||||
|
PATH="$PYENV_ROOT/bin:$PATH";
|
||||||
|
eval "$(pyenv init -)";
|
||||||
|
pyenv install pypy-4.0.1;
|
||||||
|
pyenv global pypy-4.0.1;
|
||||||
|
python --version;
|
||||||
|
pip --version;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The OS X VM doesn't have any Python support at all
|
||||||
|
# See https://github.com/travis-ci/travis-ci/issues/2312
|
||||||
|
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
|
||||||
|
brew update
|
||||||
|
brew install python3
|
||||||
|
virtualenv -p python3 $HOME/osx-py3
|
||||||
|
. $HOME/osx-py3/bin/activate
|
||||||
|
fi
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import unicodedata
|
||||||
from textwrap import dedent
|
from textwrap import dedent
|
||||||
|
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
|
|
@ -13,7 +14,7 @@ from pkg_resources import load_entry_point
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import vdirsyncer.cli as cli
|
import vdirsyncer.cli as cli
|
||||||
from vdirsyncer.utils.compat import PY2, to_native
|
from vdirsyncer.utils.compat import PY2, to_native, to_unicode
|
||||||
|
|
||||||
|
|
||||||
def test_entry_points(monkeypatch, capsys):
|
def test_entry_points(monkeypatch, capsys):
|
||||||
|
|
@ -331,10 +332,22 @@ def test_create_collections(subtest, collections):
|
||||||
input='y\n' * 2 * (len(collections) + 1)
|
input='y\n' * 2 * (len(collections) + 1)
|
||||||
)
|
)
|
||||||
assert not result.exception
|
assert not result.exception
|
||||||
assert \
|
|
||||||
set(x.basename for x in tmpdir.join('foo').listdir()) == \
|
# Macs normally operate on the HFS+ file system which normalizes paths.
|
||||||
set(x.basename for x in tmpdir.join('bar').listdir()) == \
|
# That is, if you save a file with accented é in it (u'\xe9') for
|
||||||
set(collections)
|
# example, and then do a os.listdir you will see that the filename got
|
||||||
|
# converted to u'e\u0301'. This is normal unicode NFD normalization
|
||||||
|
# that the Python unicodedata module can handle.
|
||||||
|
#
|
||||||
|
# Quoted from
|
||||||
|
# https://stackoverflow.com/questions/18137554/how-to-convert-path-to-mac-os-x-path-the-almost-nfd-normal-form # noqa
|
||||||
|
u = lambda xs: set(
|
||||||
|
unicodedata.normalize('NFKD', to_unicode(x, 'utf-8'))
|
||||||
|
for x in xs
|
||||||
|
)
|
||||||
|
assert u(x.basename for x in tmpdir.join('foo').listdir()) == \
|
||||||
|
u(x.basename for x in tmpdir.join('bar').listdir()) == \
|
||||||
|
u(collections)
|
||||||
|
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
['sync'] + ['foobar/' + x for x in collections]
|
['sync'] + ['foobar/' + x for x in collections]
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,9 @@ class StorageTests(object):
|
||||||
assert 'test2' in s.collection
|
assert 'test2' in s.collection
|
||||||
|
|
||||||
def test_case_sensitive_uids(self, s, get_item):
|
def test_case_sensitive_uids(self, s, get_item):
|
||||||
|
if s.storage_name == 'filesystem':
|
||||||
|
pytest.skip('Behavior depends on the filesystem.')
|
||||||
|
|
||||||
s.upload(get_item(uid='A' * 42))
|
s.upload(get_item(uid='A' * 42))
|
||||||
s.upload(get_item(uid='a' * 42))
|
s.upload(get_item(uid='a' * 42))
|
||||||
items = list(href for href, etag in s.list())
|
items = list(href for href, etag in s.list())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue