From ec221b52b4fd333f9e94b09669df6b91e21185b1 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 11:03:31 +0200 Subject: [PATCH 01/14] Update docs with new images names --- docs/contributing.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index 92f7170..29e24b7 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -102,8 +102,7 @@ initialized and documented. For example, to test xandikos, first run the server itself:: - docker build -t xandikos docker/xandikos - docker start -p 8000:8000 xandikos + docker run -p 8000:8000 whynothugo/vdirsyncer-devkit-xandikos Then run the tests specifying this ``DAV_SERVER``, run:: From bba9d43caf3970618aa568cd2bbf0e65f857fcf9 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 11:41:54 +0200 Subject: [PATCH 02/14] Remove empty install files --- Makefile | 4 +++- tests/storage/servers/fastmail/install.sh | 0 tests/storage/servers/icloud/install.sh | 0 tests/storage/servers/skip/install.sh | 0 4 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 tests/storage/servers/fastmail/install.sh delete mode 100644 tests/storage/servers/icloud/install.sh delete mode 100755 tests/storage/servers/skip/install.sh diff --git a/Makefile b/Makefile index 4ca8f2b..60f5fe5 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,9 @@ all: install-servers: set -ex; \ for server in $(DAV_SERVER); do \ - (cd $(TESTSERVER_BASE)$$server && sh install.sh); \ + if [ -f $(TESTSERVER_BASE)$$server/install.sh ]; then \ + (cd $(TESTSERVER_BASE)$$server && sh install.sh); \ + fi \ done install-test: install-servers install-dev diff --git a/tests/storage/servers/fastmail/install.sh b/tests/storage/servers/fastmail/install.sh deleted file mode 100644 index e69de29..0000000 diff --git a/tests/storage/servers/icloud/install.sh b/tests/storage/servers/icloud/install.sh deleted file mode 100644 index e69de29..0000000 diff --git a/tests/storage/servers/skip/install.sh b/tests/storage/servers/skip/install.sh deleted file mode 100755 index e69de29..0000000 From 91ffb931e19ff4045ad5155872991042de37b8d7 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 11:52:21 +0200 Subject: [PATCH 03/14] Move baikal out-of-repo too --- docker/baikal/Dockerfile | 26 ----- docker/baikal/apache.conf | 25 ----- docker/baikal/baikal.yaml | 18 --- docker/baikal/configure.sql | 139 ------------------------ docker/baikal/start.sh | 16 --- tests/storage/servers/baikal/install.sh | 5 +- 6 files changed, 1 insertion(+), 228 deletions(-) delete mode 100644 docker/baikal/Dockerfile delete mode 100644 docker/baikal/apache.conf delete mode 100644 docker/baikal/baikal.yaml delete mode 100644 docker/baikal/configure.sql delete mode 100644 docker/baikal/start.sh diff --git a/docker/baikal/Dockerfile b/docker/baikal/Dockerfile deleted file mode 100644 index 6b0f1ff..0000000 --- a/docker/baikal/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# Based on https://github.com/ckulka/baikal-docker -# Sadly, we can't override the VOLUME it has set, and we want some static -# config. -FROM php:7.4-apache -ENV VERSION 0.7.0 - -ADD https://github.com/sabre-io/Baikal/releases/download/$VERSION/baikal-$VERSION.zip . -RUN apt-get update && apt-get install -y sqlite3 unzip -RUN unzip -q baikal-$VERSION.zip -d /var/www/ - -RUN chown -R www-data:www-data /var/www/baikal && \ - docker-php-ext-install pdo pdo_mysql - -COPY apache.conf /etc/apache2/sites-enabled/000-default.conf -COPY start.sh /opt/ -RUN a2enmod rewrite - -COPY baikal.yaml /var/www/baikal/config/baikal.yaml -COPY configure.sql /configure.sql - -RUN touch /var/www/baikal/Specific/INSTALL_DISABLED -RUN cat /configure.sql | sqlite3 /var/www/baikal/Specific/db/db.sqlite - -RUN chmod -R 777 /var/www/baikal/Specific/ /var/www/baikal/config/ - -CMD [ "sh", "/opt/start.sh" ] diff --git a/docker/baikal/apache.conf b/docker/baikal/apache.conf deleted file mode 100644 index a6b35f5..0000000 --- a/docker/baikal/apache.conf +++ /dev/null @@ -1,25 +0,0 @@ -# Shameless copied from https://github.com/ckulka/baikal-docker/blob/master/files/apache.conf - - - - # InjectedServerAlias dav.example.org dav.example.io - DocumentRoot /var/www/baikal/html - - RewriteEngine On - RewriteRule /.well-known/carddav /dav.php [R,L] - RewriteRule /.well-known/caldav /dav.php [R,L] - - - Options None - Options +FollowSymlinks - AllowOverride All - - # Confiugration for apache-2.2: - Order allow,deny - Allow from all - - # Confiugration for apache-2.4: - Require all granted - - - diff --git a/docker/baikal/baikal.yaml b/docker/baikal/baikal.yaml deleted file mode 100644 index 459e455..0000000 --- a/docker/baikal/baikal.yaml +++ /dev/null @@ -1,18 +0,0 @@ -system: - configured_version: 0.7.0 - timezone: Europe/Paris - card_enabled: true - cal_enabled: true - dav_auth_type: Basic - admin_passwordhash: 6a890c3aa185845a4bee1e1caed92e1faaf2dec6772291dca301cef6782e3bce - auth_realm: BaikalDAV - invite_from: noreply@localhost -database: - sqlite_file: /var/www/baikal/Specific/db/db.sqlite - mysql: false - mysql_host: '' - mysql_dbname: '' - mysql_username: '' - mysql_password: '' - encryption_key: bdf3bec969736e122e6d5f72c282c49e - configured_version: '' diff --git a/docker/baikal/configure.sql b/docker/baikal/configure.sql deleted file mode 100644 index 55ec586..0000000 --- a/docker/baikal/configure.sql +++ /dev/null @@ -1,139 +0,0 @@ -PRAGMA foreign_keys=OFF; -BEGIN TRANSACTION; -CREATE TABLE addressbooks ( - id integer primary key asc NOT NULL, - principaluri text NOT NULL, - displayname text, - uri text NOT NULL, - description text, - synctoken integer DEFAULT 1 NOT NULL -); -INSERT INTO addressbooks VALUES(1,'principals/baikal','Default Address Book','default','Default Address Book for Baikal',1); -CREATE TABLE cards ( - id integer primary key asc NOT NULL, - addressbookid integer NOT NULL, - carddata blob, - uri text NOT NULL, - lastmodified integer, - etag text, - size integer -); -CREATE TABLE addressbookchanges ( - id integer primary key asc NOT NULL, - uri text, - synctoken integer NOT NULL, - addressbookid integer NOT NULL, - operation integer NOT NULL -); -CREATE TABLE calendarobjects ( - id integer primary key asc NOT NULL, - calendardata blob NOT NULL, - uri text NOT NULL, - calendarid integer NOT NULL, - lastmodified integer NOT NULL, - etag text NOT NULL, - size integer NOT NULL, - componenttype text, - firstoccurence integer, - lastoccurence integer, - uid text -); -CREATE TABLE calendars ( - id integer primary key asc NOT NULL, - synctoken integer DEFAULT 1 NOT NULL, - components text NOT NULL -); -INSERT INTO calendars VALUES(1,1,'VEVENT,VTODO'); -CREATE TABLE calendarinstances ( - id integer primary key asc NOT NULL, - calendarid integer, - principaluri text, - access integer, - displayname text, - uri text NOT NULL, - description text, - calendarorder integer, - calendarcolor text, - timezone text, - transparent bool, - share_href text, - share_displayname text, - share_invitestatus integer DEFAULT '2', - UNIQUE (principaluri, uri), - UNIQUE (calendarid, principaluri), - UNIQUE (calendarid, share_href) -); -INSERT INTO calendarinstances VALUES(1,1,'principals/baikal',NULL,'Default calendar','default','Default calendar',0,'','Europe/Paris',NULL,NULL,NULL,2); -CREATE TABLE calendarchanges ( - id integer primary key asc NOT NULL, - uri text, - synctoken integer NOT NULL, - calendarid integer NOT NULL, - operation integer NOT NULL -); -CREATE TABLE calendarsubscriptions ( - id integer primary key asc NOT NULL, - uri text NOT NULL, - principaluri text NOT NULL, - source text NOT NULL, - displayname text, - refreshrate text, - calendarorder integer, - calendarcolor text, - striptodos bool, - stripalarms bool, - stripattachments bool, - lastmodified int -); -CREATE TABLE schedulingobjects ( - id integer primary key asc NOT NULL, - principaluri text NOT NULL, - calendardata blob, - uri text NOT NULL, - lastmodified integer, - etag text NOT NULL, - size integer NOT NULL -); -CREATE TABLE locks ( - id integer primary key asc NOT NULL, - owner text, - timeout integer, - created integer, - token text, - scope integer, - depth integer, - uri text -); -CREATE TABLE principals ( - id INTEGER PRIMARY KEY ASC NOT NULL, - uri TEXT NOT NULL, - email TEXT, - displayname TEXT, - UNIQUE(uri) -); -INSERT INTO principals VALUES(1,'principals/baikal','baikal@example.com','Baikal'); -CREATE TABLE groupmembers ( - id INTEGER PRIMARY KEY ASC NOT NULL, - principal_id INTEGER NOT NULL, - member_id INTEGER NOT NULL, - UNIQUE(principal_id, member_id) -); -CREATE TABLE propertystorage ( - id integer primary key asc NOT NULL, - path text NOT NULL, - name text NOT NULL, - valuetype integer NOT NULL, - value string -); -CREATE TABLE users ( - id integer primary key asc NOT NULL, - username TEXT NOT NULL, - digesta1 TEXT NOT NULL, - UNIQUE(username) -); -INSERT INTO users VALUES(1,'baikal','3b0845b235b7e985ce5905ab8df45e1a'); -CREATE INDEX addressbookid_synctoken ON addressbookchanges (addressbookid, synctoken); -CREATE INDEX calendarid_synctoken ON calendarchanges (calendarid, synctoken); -CREATE INDEX principaluri_uri ON calendarsubscriptions (principaluri, uri); -CREATE UNIQUE INDEX path_property ON propertystorage (path, name); -COMMIT; diff --git a/docker/baikal/start.sh b/docker/baikal/start.sh deleted file mode 100644 index cd41bba..0000000 --- a/docker/baikal/start.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# Shameless copied from https://raw.githubusercontent.com/ckulka/baikal-docker/master/files/start.sh - -# Inject ServerName and ServerAlias if specified -APACHE_CONFIG="/etc/apache2/sites-available/000-default.conf" -if [ ! -z ${BAIKAL_SERVERNAME+x} ] -then - sed -i "s/# InjectedServerName .*/ServerName $BAIKAL_SERVERNAME/g" $APACHE_CONFIG -fi - -if [ ! -z ${BAIKAL_SERVERALIAS+x} ] -then - sed -i "s/# InjectedServerAlias .*/ServerAlias $BAIKAL_SERVERALIAS/g" $APACHE_CONFIG -fi - -apache2-foreground diff --git a/tests/storage/servers/baikal/install.sh b/tests/storage/servers/baikal/install.sh index 023fef4..44f3c95 100644 --- a/tests/storage/servers/baikal/install.sh +++ b/tests/storage/servers/baikal/install.sh @@ -1,6 +1,3 @@ #!/bin/sh -cd $(git rev-parse --show-toplevel) - -docker build -t baikal docker/baikal -docker run -d -p 8002:80 baikal +docker run -d -p 8002:80 whynothugo/vdirsyncer-devkit-baikal From a0b814ec17b8b08568a17eaa72393a9b0c99f6fb Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 11:54:26 +0200 Subject: [PATCH 04/14] Add a bit of docs to build manifests --- .builds/archlinux.yaml | 2 ++ .builds/tests-minimal.yaml | 6 +++++- .builds/tests-release.yaml | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.builds/archlinux.yaml b/.builds/archlinux.yaml index c11a5c8..77dd24c 100644 --- a/.builds/archlinux.yaml +++ b/.builds/archlinux.yaml @@ -1,3 +1,5 @@ +# Run tests using the packaged dependencies on ArchLinux. + image: archlinux packages: - docker diff --git a/.builds/tests-minimal.yaml b/.builds/tests-minimal.yaml index 2fa6b1c..7c54770 100644 --- a/.builds/tests-minimal.yaml +++ b/.builds/tests-minimal.yaml @@ -1,4 +1,8 @@ -# TODO: Maybe shift this job to ubuntu/debian. +# Run tests using oldest available dependency versions. +# +# TODO: It might make more sense to test with an older Ubuntu or Fedora version +# here, and consider that our "oldest suppported environment". + image: archlinux packages: - docker diff --git a/.builds/tests-release.yaml b/.builds/tests-release.yaml index 55d51e1..d87f903 100644 --- a/.builds/tests-release.yaml +++ b/.builds/tests-release.yaml @@ -1,3 +1,5 @@ +# Run tests using latest dependencies from PyPI + image: archlinux packages: - docker From 96f1c41beea8fb25376c1caa7c1862a175daa707 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 11:54:49 +0200 Subject: [PATCH 05/14] Run CI with Baikal too --- .builds/tests-release.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.builds/tests-release.yaml b/.builds/tests-release.yaml index d87f903..5e7fa05 100644 --- a/.builds/tests-release.yaml +++ b/.builds/tests-release.yaml @@ -17,13 +17,14 @@ tasks: - setup: | cd vdirsyncer sudo systemctl start docker - DAV_SERVER="radicale xandikos" make -e install-test + DAV_SERVER="radicale xandikos baikal" make -e install-test make -e install-style - test: | cd vdirsyncer # Non-system python is used for packages: export PATH=$PATH:~/.local/bin/ make -e ci-test + DAV_SERVER=baikal make -e ci-test-storage DAV_SERVER=radicale make -e ci-test-storage DAV_SERVER=xandikos make -e ci-test-storage - style: | From eec142ac152d46e1d417fe260c88e7462a8d566f Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 12:02:37 +0200 Subject: [PATCH 06/14] Drop mysteryshack support It's been unmaintained for years, so no point in keeping track of compatibility. --- tests/storage/servers/mysteryshack/.gitignore | 1 - .../storage/servers/mysteryshack/__init__.py | 79 ------------------- tests/storage/servers/mysteryshack/install.sh | 18 ----- tests/storage/servers/mysteryshack/make.sh | 9 --- .../storage/servers/mysteryshack/variables.sh | 1 - 5 files changed, 108 deletions(-) delete mode 100644 tests/storage/servers/mysteryshack/.gitignore delete mode 100644 tests/storage/servers/mysteryshack/__init__.py delete mode 100644 tests/storage/servers/mysteryshack/install.sh delete mode 100644 tests/storage/servers/mysteryshack/make.sh delete mode 100644 tests/storage/servers/mysteryshack/variables.sh diff --git a/tests/storage/servers/mysteryshack/.gitignore b/tests/storage/servers/mysteryshack/.gitignore deleted file mode 100644 index 904d2ca..0000000 --- a/tests/storage/servers/mysteryshack/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mysteryshack diff --git a/tests/storage/servers/mysteryshack/__init__.py b/tests/storage/servers/mysteryshack/__init__.py deleted file mode 100644 index c589535..0000000 --- a/tests/storage/servers/mysteryshack/__init__.py +++ /dev/null @@ -1,79 +0,0 @@ -import os -import shutil -import subprocess -import time - -import pytest -import requests - -testserver_repo = os.path.dirname(__file__) -make_sh = os.path.abspath(os.path.join(testserver_repo, "make.sh")) - - -def wait(): - for i in range(100): - try: - requests.get("http://127.0.0.1:6767/", verify=False) - except Exception as e: - # Don't know exact exception class, don't care. - # Also, https://github.com/kennethreitz/requests/issues/2192 - if "connection refused" not in str(e).lower(): - raise - time.sleep(2 ** i) - else: - return True - return False - - -class ServerMixin: - @pytest.fixture(scope="session") - def setup_mysteryshack_server(self, xprocess): - def preparefunc(cwd): - return wait, ["sh", make_sh, "testserver"] - - subprocess.check_call(["sh", make_sh, "testserver-config"]) - xprocess.ensure("mysteryshack_server", preparefunc) - - return ( - subprocess.check_output( - [ - os.path.join( - testserver_repo, "mysteryshack/target/debug/mysteryshack" - ), - "-c", - "/tmp/mysteryshack/config", - "user", - "authorize", - "testuser", - "https://example.com", - self.storage_class.scope + ":rw", - ] - ) - .strip() - .decode() - ) - - @pytest.fixture - def get_storage_args(self, monkeypatch, setup_mysteryshack_server): - from requests import Session - - monkeypatch.setitem(os.environ, "OAUTHLIB_INSECURE_TRANSPORT", "true") - - old_request = Session.request - - def request(self, method, url, **kw): - url = url.replace("https://", "http://") - return old_request(self, method, url, **kw) - - monkeypatch.setattr(Session, "request", request) - shutil.rmtree("/tmp/mysteryshack/testuser/data", ignore_errors=True) - shutil.rmtree("/tmp/mysteryshack/testuser/meta", ignore_errors=True) - - def inner(**kw): - kw["account"] = "testuser@127.0.0.1:6767" - kw["access_token"] = setup_mysteryshack_server - if self.storage_class.fileext == ".ics": - kw.setdefault("collection", "test") - return kw - - return inner diff --git a/tests/storage/servers/mysteryshack/install.sh b/tests/storage/servers/mysteryshack/install.sh deleted file mode 100644 index 36b1269..0000000 --- a/tests/storage/servers/mysteryshack/install.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -ex -cd "$(dirname "$0")" -. ./variables.sh - -if [ "$CI" = "true" ]; then - curl -sL https://static.rust-lang.org/rustup.sh -o ~/rust-installer/rustup.sh - sh ~/rust-installer/rustup.sh --prefix=~/rust --spec=stable -y --disable-sudo 2> /dev/null -fi - -if [ ! -d mysteryshack ]; then - git clone https://github.com/untitaker/mysteryshack -fi - -pip install pytest-xprocess - -cd mysteryshack -make debug-build # such that first test doesn't hang too long w/o output diff --git a/tests/storage/servers/mysteryshack/make.sh b/tests/storage/servers/mysteryshack/make.sh deleted file mode 100644 index c2484a4..0000000 --- a/tests/storage/servers/mysteryshack/make.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -e - -# pytest-xprocess doesn't allow us to CD into a particular directory before -# launching a command, so we do it here. -cd "$(dirname "$0")" -. ./variables.sh -cd mysteryshack -exec make "$@" diff --git a/tests/storage/servers/mysteryshack/variables.sh b/tests/storage/servers/mysteryshack/variables.sh deleted file mode 100644 index 8eda6e7..0000000 --- a/tests/storage/servers/mysteryshack/variables.sh +++ /dev/null @@ -1 +0,0 @@ -export PATH="$PATH:$HOME/.cargo/bin/" From 9d3ef030fa864b3c299fb13971ee5c31d4f16ec5 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 12:41:30 +0200 Subject: [PATCH 07/14] Remove pointless condition These tasks are named "ci-*", no point in hiding them in other envs. --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 60f5fe5..295631d 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,6 @@ PYTEST = py.test $(PYTEST_ARGS) export TESTSERVER_BASE := ./tests/storage/servers/ CODECOV_PATH = /tmp/codecov.sh -ifeq ($(CI), true) ci-test: curl -s https://codecov.io/bash > $(CODECOV_PATH) $(PYTEST) tests/unit/ @@ -48,14 +47,14 @@ ci-test: $(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) -endif all: $(error Take a look at https://vdirsyncer.pimutils.org/en/stable/tutorial.html#installation) From 320ac6020b585907ff2f11310e81da583abe98ce Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 12:58:13 +0200 Subject: [PATCH 08/14] Tweak linter to ignore less issues --- setup.cfg | 16 ++++++++-------- vdirsyncer/storage/google.py | 3 +-- vdirsyncer/sync/__init__.py | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/setup.cfg b/setup.cfg index e3d4d5c..764020d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,12 +11,12 @@ addopts = --no-cov-on-fail [flake8] -# E731: Use a def instead of lambda expr -# E743: Ambiguous function definition -ignore = E731, E743 -# E503: Line break occurred before a binary operator -extend-ignore = E203, W503 +application-import-names = tests,vdirsyncer +extend-ignore = + E203, # Black-incompatible colon spacing. + W503, # Line jump before binary operator. + I100, + I202 max-line-length = 88 -select = C,E,F,W,B,B9 -exclude = .eggs, tests/storage/servers/owncloud/, tests/storage/servers/nextcloud/, tests/storage/servers/baikal/, build/ -application-package-names = tests,vdirsyncer +exclude = .eggs,build +import-order-style = smarkets diff --git a/vdirsyncer/storage/google.py b/vdirsyncer/storage/google.py index abdb63d..09d3535 100644 --- a/vdirsyncer/storage/google.py +++ b/vdirsyncer/storage/google.py @@ -42,8 +42,7 @@ class GoogleSession(dav.DAVSession): token_file = expand_path(token_file) ui_worker = get_ui_worker() - f = lambda: self._init_token(token_file, client_id, client_secret) - ui_worker.put(f) + ui_worker.put(lambda: self._init_token(token_file, client_id, client_secret)) def _init_token(self, token_file, client_id, client_secret): token = None diff --git a/vdirsyncer/sync/__init__.py b/vdirsyncer/sync/__init__.py index aa8c1f4..286c66c 100644 --- a/vdirsyncer/sync/__init__.py +++ b/vdirsyncer/sync/__init__.py @@ -127,9 +127,9 @@ def sync( raise BothReadOnly() if conflict_resolution == "a wins": - conflict_resolution = lambda a, b: a + conflict_resolution = lambda a, b: a # noqa: E731 elif conflict_resolution == "b wins": - conflict_resolution = lambda a, b: b + conflict_resolution = lambda a, b: b # noqa: E731 status_nonempty = bool(next(status.iter_old(), None)) From e467809bb0a0a4f12fcea9e11e08162388c9e29a Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 13:08:04 +0200 Subject: [PATCH 09/14] Update pre-commit hooks --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c40abe1..d4f167b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.0.1 hooks: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] @@ -9,12 +9,12 @@ repos: - id: check-added-large-files - id: debug-statements - repo: https://gitlab.com/pycqa/flake8 - rev: "3.9.1" + rev: "3.9.2" hooks: - id: flake8 additional_dependencies: [flake8-import-order, flake8-bugbear] - repo: https://github.com/psf/black - rev: "21.5b0" + rev: "21.6b0" hooks: - id: black - repo: https://github.com/asottile/reorder_python_imports From 5a97307a2f9aa987462abc1fd26c439552d9c07e Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 13:08:17 +0200 Subject: [PATCH 10/14] Remove unecessary exclusion --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 764020d..40e5673 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,6 @@ universal = 1 [tool:pytest] -norecursedirs = tests/storage/servers/* addopts = --tb=short --cov-config .coveragerc From ee124f5c82e4359037c9717afd24960a3f712d82 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 13:09:20 +0200 Subject: [PATCH 11/14] Improve readability of failed tests --- vdirsyncer/http.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vdirsyncer/http.py b/vdirsyncer/http.py index 50be5fb..1f223e1 100644 --- a/vdirsyncer/http.py +++ b/vdirsyncer/http.py @@ -142,6 +142,7 @@ def request( func = session.request + logger.debug("=" * 20) logger.debug(f"{method} {url}") logger.debug(kwargs.get("headers", {})) logger.debug(kwargs.get("data", None)) From a9fa61040fb055501e67a558feb9a1dc96457f6c Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 13:18:11 +0200 Subject: [PATCH 12/14] Tidy up some collection initializations --- tests/storage/__init__.py | 4 ++-- vdirsyncer/http.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/storage/__init__.py b/tests/storage/__init__.py index e48201a..73eeee3 100644 --- a/tests/storage/__init__.py +++ b/tests/storage/__init__.py @@ -210,7 +210,7 @@ class StorageTests: s = self.storage_class(**self.storage_class.create_collection(**args)) href = s.upload(get_item())[0] - assert href in {href for href, etag in s.list()} + assert href in (href for href, etag in s.list()) def test_discover_collection_arg(self, requires_collections, get_storage_args): args = get_storage_args(collection="test2") @@ -239,7 +239,7 @@ class StorageTests: uid = str(uuid.uuid4()) s.upload(get_item(uid=uid.upper())) s.upload(get_item(uid=uid.lower())) - items = list(href for href, etag in s.list()) + items = [href for href, etag in s.list()] assert len(items) == 2 assert len(set(items)) == 2 diff --git a/vdirsyncer/http.py b/vdirsyncer/http.py index 1f223e1..f6c6a37 100644 --- a/vdirsyncer/http.py +++ b/vdirsyncer/http.py @@ -138,7 +138,7 @@ def request( if verify_fingerprint is not None: _install_fingerprint_adapter(session, verify_fingerprint) - session.hooks = dict(response=_fix_redirects) + session.hooks = {"response": _fix_redirects} func = session.request From 6c80293a9895ccd611cdc4533d4474ad21e0523d Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 13:26:01 +0200 Subject: [PATCH 13/14] Mark failing baikal tests as xfail --- tests/storage/dav/test_caldav.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/storage/dav/test_caldav.py b/tests/storage/dav/test_caldav.py index b92cb38..4a59a9f 100644 --- a/tests/storage/dav/test_caldav.py +++ b/tests/storage/dav/test_caldav.py @@ -21,6 +21,7 @@ class TestCalDAVStorage(DAVStorageTests): def item_type(self, request): return request.param + @pytest.mark.xfail(dav_server == "baikal", reason="Baikal returns 500.") def test_doesnt_accept_vcard(self, item_type, get_storage_args): s = self.storage_class(item_types=(item_type,), **get_storage_args()) @@ -42,6 +43,7 @@ class TestCalDAVStorage(DAVStorageTests): ((), 1), ], ) + @pytest.mark.xfail(dav_server == "baikal", reason="Baikal returns 500.") def test_item_types_performance( self, get_storage_args, arg, calls_num, monkeypatch ): @@ -152,6 +154,7 @@ class TestCalDAVStorage(DAVStorageTests): @pytest.mark.skipif( dav_server == "fastmail", reason="Fastmail has non-standard hadling of VTODOs." ) + @pytest.mark.xfail(dav_server == "baikal", reason="Baikal returns 500.") def test_item_types_general(self, s): event = s.upload(format_item(EVENT_TEMPLATE))[0] task = s.upload(format_item(TASK_TEMPLATE))[0] From 4450393d4f4fc0e584dc7ba361949e6fedfcbdae Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Sat, 12 Jun 2021 13:27:47 +0200 Subject: [PATCH 14/14] Typo Fixes #892 --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cdab3e1..e4c6ed7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,7 +18,7 @@ Note: Version 0.17 has some alpha releases but ultimately was never finalised. - Support for Python 3.5 and 3.6 has been dropped. This release mostly focuses on keeping vdirsyncer compatible with newer environments. - click 8 and click-threading 0.5.0 are now required. -- For those using ``pipx``, we now recommend using ``pipx``, it's successor. +- For those using ``pipsi``, we now recommend using ``pipx``, it's successor. - Python 3.9 is now supported. - Our Debian/Ubuntu build scripts have been updated. New versions should be pushed to those repositories soon.