diff --git a/.travis.yml b/.travis.yml index 09be602..4c6f26c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,16 +4,7 @@ sudo: true language: python install: - - 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 + - ". scripts/travis-install.sh" - "pip install -U pip" - "pip install wheel" - "make -e install-dev" @@ -112,6 +103,9 @@ matrix: env: BUILD=test DAV_SERVER=radicale REQUIREMENTS=release - python: pypy env: BUILD=test DAV_SERVER=radicale REQUIREMENTS=minimal + - language: generic + os: osx + env: BUILD=test branches: diff --git a/scripts/make_travisconf.py b/scripts/make_travisconf.py index d094588..03cb8e7 100644 --- a/scripts/make_travisconf.py +++ b/scripts/make_travisconf.py @@ -25,21 +25,7 @@ p("language: python") p("") with section("install"): - # 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 - 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('- ". scripts/travis-install.sh"') p('- "pip install -U pip"') p('- "pip install wheel"') @@ -79,6 +65,10 @@ with section("matrix"): server=server, requirements=requirements)) + p("- language: generic") + p(" os: osx") + p(" env: BUILD=test") + with section("branches"): with section("only"): p('- auto') diff --git a/scripts/travis-install.sh b/scripts/travis-install.sh new file mode 100644 index 0000000..2dc277e --- /dev/null +++ b/scripts/travis-install.sh @@ -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 diff --git a/tests/cli/test_main.py b/tests/cli/test_main.py index 1cd8e2b..1cba9f8 100644 --- a/tests/cli/test_main.py +++ b/tests/cli/test_main.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import json +import unicodedata from textwrap import dedent from click.testing import CliRunner @@ -13,7 +14,7 @@ from pkg_resources import load_entry_point import pytest 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): @@ -331,10 +332,22 @@ def test_create_collections(subtest, collections): input='y\n' * 2 * (len(collections) + 1) ) assert not result.exception - assert \ - set(x.basename for x in tmpdir.join('foo').listdir()) == \ - set(x.basename for x in tmpdir.join('bar').listdir()) == \ - set(collections) + + # Macs normally operate on the HFS+ file system which normalizes paths. + # That is, if you save a file with accented é in it (u'\xe9') for + # 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( ['sync'] + ['foobar/' + x for x in collections] diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py index 5503f40..19397b5 100644 --- a/tests/storage/__init__.py +++ b/tests/storage/__init__.py @@ -213,6 +213,9 @@ class StorageTests(object): assert 'test2' in s.collection 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)) items = list(href for href, etag in s.list())