Merge master into dav_default_ns

This commit is contained in:
Hugo Osvaldo Barrera 2021-04-07 08:42:29 +02:00
commit 2685f8db68
23 changed files with 203 additions and 276 deletions

16
.builds/style.yaml Normal file
View file

@ -0,0 +1,16 @@
image: archlinux
packages:
- docker
- docker-compose
- python-pip
sources:
- https://github.com/pimutils/vdirsyncer
tasks:
- setup: |
cd vdirsyncer
make -e install-style
- test: |
cd vdirsyncer
# Non-system python is used for packages:
export PATH=$PATH:~/.local/bin/
make -e style

View file

@ -0,0 +1,26 @@
# TODO: Maybe shift this job to ubuntu/debian.
image: archlinux
packages:
- docker
- docker-compose
- python-pip
sources:
- https://github.com/pimutils/vdirsyncer
environment:
BUILD: test
CI: true
CODECOV_TOKEN: b834a3c5-28fa-4808-9bdb-182210069c79
REQUIREMENTS: minimal
# TODO: ETESYNC_TESTS
tasks:
- setup: |
cd vdirsyncer
sudo systemctl start docker
DAV_SERVER="radicale xandikos" make -e install-test
- test: |
cd vdirsyncer
# Non-system python is used for packages:
export PATH=$PATH:~/.local/bin/
make -e ci-test
DAV_SERVER=radicale make -e ci-test-storage
DAV_SERVER=xandikos make -e ci-test-storage

View file

@ -0,0 +1,25 @@
image: archlinux
packages:
- docker
- docker-compose
- python-pip
sources:
- https://github.com/pimutils/vdirsyncer
environment:
BUILD: test
CI: true
CODECOV_TOKEN: b834a3c5-28fa-4808-9bdb-182210069c79
REQUIREMENTS: release
# TODO: ETESYNC_TESTS
tasks:
- setup: |
cd vdirsyncer
sudo systemctl start docker
DAV_SERVER="radicale xandikos" make -e install-test
- test: |
cd vdirsyncer
# Non-system python is used for packages:
export PATH=$PATH:~/.local/bin/
make -e ci-test
DAV_SERVER=radicale make -e ci-test-storage
DAV_SERVER=xandikos make -e ci-test-storage

View file

@ -5,7 +5,6 @@ repos:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
exclude: '.travis.yml'
- id: check-toml
- id: check-added-large-files
- id: debug-statements
@ -18,12 +17,3 @@ repos:
rev: v2.3.0
hooks:
- id: reorder-python-imports
- repo: local
hooks:
- id: update-travis
name: Update travis job definition
description: Ensures that travis job definition are up to date.
entry: scripts/make_travisconf.py
files: '.*travis.*'
stages: [commit]
language: script

View file

@ -1,89 +0,0 @@
{
"branches": {
"only": [
"master"
]
},
"cache": "pip",
"dist": "bionic",
"git": {
"submodules": false
},
"install": [
". scripts/travis-install.sh",
"make -e install-$BUILD"
],
"language": "python",
"matrix": {
"fast_finish": true,
"include": [
{
"env": "BUILD=style",
"python": "3.7"
},
{
"env": "BUILD=test REQUIREMENTS=release",
"python": "3.7"
},
{
"env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=release ",
"python": "3.7"
},
{
"env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=release ",
"python": "3.7"
},
{
"env": "BUILD=test-storage DAV_SERVER=fastmail REQUIREMENTS=release ",
"python": "3.7"
},
{
"env": "BUILD=test REQUIREMENTS=minimal",
"python": "3.7"
},
{
"env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=minimal ",
"python": "3.7"
},
{
"env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=minimal ",
"python": "3.7"
},
{
"env": "BUILD=test REQUIREMENTS=release",
"python": "3.8"
},
{
"env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=release ",
"python": "3.8"
},
{
"env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=release ",
"python": "3.8"
},
{
"env": "BUILD=test REQUIREMENTS=minimal",
"python": "3.8"
},
{
"env": "BUILD=test-storage DAV_SERVER=radicale REQUIREMENTS=minimal ",
"python": "3.8"
},
{
"env": "BUILD=test-storage DAV_SERVER=xandikos REQUIREMENTS=minimal ",
"python": "3.8"
},
{
"env": "BUILD=test ETESYNC_TESTS=true REQUIREMENTS=latest",
"python": "3.7"
}
]
},
"script": [
"make -e $BUILD"
],
"services": [
"docker"
],
"sudo": true
}

View file

@ -1,6 +1,5 @@
# setuptools-scm includes everything tracked by git
prune docker
prune docker-compose
prune scripts
prune tests/storage/servers
prune tests/storage/etesync

View file

@ -15,7 +15,7 @@ export DETERMINISTIC_TESTS := false
# Run the etesync testsuite.
export ETESYNC_TESTS := false
# Assume to run in Travis. Don't use this outside of a virtual machine. It will
# Assume to run in CI. Don't use this outside of a virtual machine. It will
# heavily "pollute" your system, such as attempting to install a new Python
# systemwide.
export CI := false
@ -41,17 +41,17 @@ export TESTSERVER_BASE := ./tests/storage/servers/
CODECOV_PATH = /tmp/codecov.sh
ifeq ($(CI), true)
test-storage:
curl -s https://codecov.io/bash > $(CODECOV_PATH)
$(PYTEST) tests/storage/
bash $(CODECOV_PATH) -c -F storage
test:
ci-test:
curl -s https://codecov.io/bash > $(CODECOV_PATH)
$(PYTEST) tests/unit/
bash $(CODECOV_PATH) -c -F unit
$(PYTEST) tests/system/
bash $(CODECOV_PATH) -c -F system
[ "$(ETESYNC_TESTS)" = "false" ] || make test-storage
ci-test-storage:
curl -s https://codecov.io/bash > $(CODECOV_PATH)
$(PYTEST) tests/storage/
bash $(CODECOV_PATH) -c -F storage
else
test:
$(PYTEST)
@ -79,10 +79,6 @@ install-test: install-servers install-dev
fi
[ -z "$(TEST_EXTRA_PACKAGES)" ] || pip install $(TEST_EXTRA_PACKAGES)
install-test-storage: install-test
# This is just an alias
true
install-style: install-docs install-dev
pip install pre-commit
@ -120,12 +116,4 @@ install-dev:
pip install -U --force-reinstall $$(python setup.py --quiet minimal_requirements); \
fi
ssh-submodule-urls:
git submodule foreach "\
echo -n 'Old: '; \
git remote get-url origin; \
git remote set-url origin \$$(git remote get-url origin | sed -e 's/https:\/\/github\.com\//git@github.com:/g'); \
echo -n 'New URL: '; \
git remote get-url origin"
.PHONY: docs

View file

@ -2,8 +2,8 @@
vdirsyncer
==========
.. image:: https://travis-ci.org/pimutils/vdirsyncer.svg?branch=master
:target: https://travis-ci.org/pimutils/vdirsyncer
.. image:: https://builds.sr.ht/~whynothugo/vdirsyncer.svg
:target: https://builds.sr.ht/~whynothugo/vdirsyncer
:alt: CI status
.. image:: https://codecov.io/github/pimutils/vdirsyncer/coverage.svg?branch=master

View file

@ -1,17 +0,0 @@
version: '3'
services:
xandikos:
build: docker/xandikos/
ports:
- '8000:8000'
radicale:
build: docker/radicale/
ports:
- '8001:8001'
baikal:
build: docker/baikal/
ports:
- '8002:80'

View file

@ -266,7 +266,7 @@ in terms of data safety**. See `this blog post
<https://evertpot.com/google-carddav-issues/>`_ for the details. Always back
up your data.
At first run you will be asked to authorize application for google account
At first run you will be asked to authorize application for Google account
access.
To use this storage type, you need to install some additional dependencies::

View file

@ -75,8 +75,8 @@ Submitting patches, pull requests
Running tests, how to set up your development environment
---------------------------------------------------------
For many patches, it might suffice to just let Travis run the tests. However,
Travis is slow, so you might want to run them locally too. For this, set up a
For many patches, it might suffice to just let CI run the tests. However,
CI is slow, so you might want to run them locally too. For this, set up a
virtualenv_ and run this inside of it::
# install:
@ -102,8 +102,8 @@ initialized and documented.
For example, to test xandikos, first run the server itself::
docker-compose build xandikos
docker-compose up -d xandikos
docker build -t xandikos docker/xandikos
docker start -p 8000:8000 xandikos
Then run the tests specifying this ``DAV_SERVER``, run::

48
scripts/make_ci_conf.py Executable file
View file

@ -0,0 +1,48 @@
#!/usr/bin/env python
from pathlib import Path
REPO_ROOT = Path(__file__).parent.parent
builds = [
{
"BUILD": "style",
"REQUIREMENTS": "release",
"DAV_SERVER": "skip",
},
{
"ETESYNC_TESTS": "true",
"BUILD": "test",
"REQUIREMENTS": "release",
"DAV_SERVER": "skip",
},
]
# XXX: Use `devel` here for recent python versions:
for requirements in ("release", "minimal"):
# XXX: `fastmail` has been left out here:
dav_servers = ("radicale", "xandikos")
builds.append(
{
"BUILD": "test",
"REQUIREMENTS": requirements,
"DAV_SERVER": "skip",
},
)
for dav_server in dav_servers:
job = {
"BUILD": "test-storage",
"REQUIREMENTS": requirements,
"DAV_SERVER": dav_server,
}
with open(REPO_ROOT / "scripts" / "tests.template") as f:
template = f.read()
# TODO: Delete previous ones...
for i, build in enumerate(builds):
with open(REPO_ROOT / ".builds" / f"{i}.yaml", "w") as f:
f.write(template.format(**build))

View file

@ -1,82 +0,0 @@
#!/usr/bin/env python
import itertools
import json
python_versions = ["3.7", "3.8"]
cfg = {}
cfg['sudo'] = True
cfg['dist'] = 'bionic'
cfg['language'] = 'python'
cfg['cache'] = 'pip'
cfg['services'] = ['docker']
cfg['git'] = {
'submodules': False
}
cfg['branches'] = {
'only': ['master']
}
cfg['install'] = """
. scripts/travis-install.sh
make -e install-$BUILD
""".strip().splitlines()
cfg['script'] = ["make -e $BUILD"]
matrix = []
cfg['matrix'] = {'include': matrix, 'fast_finish': True}
matrix.append({
'python': python_versions[0],
'env': 'BUILD=style'
})
for python, requirements in itertools.product(
python_versions,
# XXX: Use `devel` here for recent python versions:
("release", "minimal")
):
dav_servers = ("radicale", "xandikos")
matrix.append({
'python': python,
'env': f"BUILD=test REQUIREMENTS={requirements}",
})
if python == python_versions[0] and requirements == "release":
dav_servers += ("fastmail",)
for dav_server in dav_servers:
job = {
'python': python,
'env': ("BUILD=test-storage "
f"DAV_SERVER={dav_server} "
f"REQUIREMENTS={requirements} ")
}
if dav_server in ("davical", "icloud"):
job['if'] = 'NOT (type IN (pull_request))'
matrix.append(job)
matrix.append({
'python': python_versions[0],
'env': ("BUILD=test "
"ETESYNC_TESTS=true "
"REQUIREMENTS=latest")
})
# matrix.append({
# 'language': 'generic',
# 'os': 'osx',
# 'env': 'BUILD=test'
# })
with open('.travis.yml', 'w') as output:
json.dump(cfg, output, sort_keys=True, indent=2)

21
scripts/tests.template Normal file
View file

@ -0,0 +1,21 @@
# vim: ft=yaml
image: archlinux
packages:
- docker
- python-pip
sources:
- https://github.com/pimutils/vdirsyncer
environment:
BUILD: {BUILD}
REQUIREMENTS: {REQUIREMENTS}
DAV_SERVER: {DAV_SERVER}
tasks:
- setup: |
cd vdirsyncer
make -e install-$BUILD
- test: |
cd vdirsyncer
# Non-system python is used for packages:
export PATH=$PATH:~/.local/bin/
make -e $BUILD

View file

@ -1,10 +0,0 @@
#!/bin/sh
# 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

View file

@ -89,6 +89,7 @@ setup(
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Internet',
'Topic :: Utilities',
],

View file

@ -1,5 +1,4 @@
hypothesis>=5.0.0
hypothesis>=5.0.0,<6.0.0
pytest
pytest-cov
pytest-localserver
pytest-subtesthack

View file

@ -1,4 +1,6 @@
#!/bin/sh
docker-compose build baikal
docker-compose up -d baikal
cd $(git rev-parse --show-toplevel)
docker build -t baikal docker/baikal
docker run -d -p 8002:80 baikal

View file

@ -1,4 +1,6 @@
#!/bin/sh
docker-compose build radicale
docker-compose up -d radicale
cd $(git rev-parse --show-toplevel)
docker build -t radicale docker/radicale
docker run -d -p 8001:8001 radicale

View file

@ -1,4 +1,6 @@
#!/bin/sh
docker-compose build xandikos
docker-compose up -d xandikos
cd $(git rev-parse --show-toplevel)
docker build -t xandikos docker/xandikos
docker run -d -p 8000:8000 xandikos

View file

@ -271,6 +271,9 @@ def test_multiple_pairs(tmpdir, runner):
}
hack = 0
# XXX: https://github.com/pimutils/vdirsyncer/issues/617
@pytest.mark.skipif(sys.platform == 'darwin',
reason='This test inexplicably fails')
@ -291,40 +294,45 @@ def test_multiple_pairs(tmpdir, runner):
@example(collections=['persönlich'])
@example(collections={'a', 'A'})
@example(collections={'\ufffe'})
def test_create_collections(subtest, collections):
def test_create_collections(collections, tmpdir, runner):
# Hypothesis calls this tests in a way that fixtures are not reset, to tmpdir is the
# same for each call.
# This horrible hack creates a new subdirectory on each run, effectively giving us a
# new tmpdir each run.
global hack
hack += 1
tmpdir = tmpdir / f"sub{hack}"
@subtest
def test_inner(tmpdir, runner):
runner.write_with_general(dedent('''
[pair foobar]
a = "foo"
b = "bar"
collections = {colls}
runner.write_with_general(dedent('''
[pair foobar]
a = "foo"
b = "bar"
collections = {colls}
[storage foo]
type = "filesystem"
path = "{base}/foo/"
fileext = ".txt"
[storage foo]
type = "filesystem"
path = "{base}/foo/"
fileext = ".txt"
[storage bar]
type = "filesystem"
path = "{base}/bar/"
fileext = ".txt"
'''.format(base=str(tmpdir), colls=json.dumps(list(collections)))))
[storage bar]
type = "filesystem"
path = "{base}/bar/"
fileext = ".txt"
'''.format(base=str(tmpdir), colls=json.dumps(list(collections)))))
result = runner.invoke(
['discover'],
input='y\n' * 2 * (len(collections) + 1)
)
assert not result.exception, result.output
result = runner.invoke(
['discover'],
input='y\n' * 2 * (len(collections) + 1)
)
assert not result.exception, result.output
result = runner.invoke(
['sync'] + ['foobar/' + x for x in collections]
)
assert not result.exception, result.output
result = runner.invoke(
['sync'] + ['foobar/' + x for x in collections]
)
assert not result.exception, result.output
assert {x.basename for x in tmpdir.join('foo').listdir()} == \
{x.basename for x in tmpdir.join('bar').listdir()}
assert {x.basename for x in tmpdir.join('foo').listdir()} == \
{x.basename for x in tmpdir.join('bar').listdir()}
def test_ident_conflict(tmpdir, runner):

View file

@ -23,14 +23,12 @@ def test_get_storage_init_args():
assert not required
def test_request_ssl(httpsserver):
httpsserver.serve_content('') # we need to serve something
def test_request_ssl():
with pytest.raises(requests.exceptions.ConnectionError) as excinfo:
http.request('GET', httpsserver.url)
http.request('GET', "https://self-signed.badssl.com/")
assert 'certificate verify failed' in str(excinfo.value)
http.request('GET', httpsserver.url, verify=False)
http.request('GET', "https://self-signed.badssl.com/", verify=False)
def _fingerprints_broken():

View file

@ -352,4 +352,4 @@ def test_component_contains():
assert 'BAZ' not in item
with pytest.raises(ValueError):
42 in item
42 in item # noqa: B015