mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +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
|
||||
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
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 -*-
|
||||
|
||||
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]
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in a new issue