From 864eb5931ae8d424081921766eaae997cd3bd1ab Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Sat, 15 Apr 2017 10:51:00 +0200 Subject: [PATCH] Merge setup.cfg and pytest.ini, fix tests --- pytest.ini | 5 ----- radicale.py | 1 - radicale/__init__.py | 6 +++--- radicale/__main__.py | 4 ++-- radicale/storage.py | 11 +++++------ radicale/tests/test_base.py | 3 ++- radicale/xmlutils.py | 11 ++++++----- setup.cfg | 9 ++++++++- 8 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 0b403ed..0000000 --- a/pytest.ini +++ /dev/null @@ -1,5 +0,0 @@ -[pytest] -# Broken with Travis, see https://gitlab.com/pycqa/flake8/issues/164 -# addopts = --flake8 --isort --cov radicale/ radicale/tests -addopts = --isort --cov radicale/ radicale/tests -norecursedirs = dist .cache .git build *.egg-info .eggs venv diff --git a/radicale.py b/radicale.py index f99bfc1..944087d 100755 --- a/radicale.py +++ b/radicale.py @@ -27,5 +27,4 @@ Launch the server according to configuration and command-line options. import radicale.__main__ - radicale.__main__.run() diff --git a/radicale/__init__.py b/radicale/__init__.py index eacb39d..0dbf74c 100644 --- a/radicale/__init__.py +++ b/radicale/__init__.py @@ -28,6 +28,7 @@ should have been included in this package. import base64 import contextlib +import datetime import io import itertools import os @@ -41,7 +42,6 @@ import threading import traceback import wsgiref.simple_server import zlib -import datetime from http import client from urllib.parse import unquote, urlparse @@ -49,7 +49,6 @@ import vobject from . import auth, rights, storage, xmlutils - VERSION = "2.0.0rc0" NOT_ALLOWED = ( @@ -125,7 +124,8 @@ class HTTPServer(wsgiref.simple_server.WSGIServer): self.logger.error("connection timeout") else: self.logger.error( - "An exception occurred during request:\n%s", traceback.format_exc()) + "An exception occurred during request:\n%s", + traceback.format_exc()) class HTTPSServer(HTTPServer): diff --git a/radicale/__main__.py b/radicale/__main__.py index 79b410a..7b24870 100644 --- a/radicale/__main__.py +++ b/radicale/__main__.py @@ -33,8 +33,8 @@ import sys from wsgiref.simple_server import make_server from . import ( - VERSION, Application, RequestHandler, ThreadedHTTPServer, - ThreadedHTTPSServer, config, log) + VERSION, Application, RequestHandler, ThreadedHTTPServer, + ThreadedHTTPSServer, config, log) def run(): diff --git a/radicale/storage.py b/radicale/storage.py index 89e06dc..ae6a4ea 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -26,6 +26,7 @@ entry. """ import contextlib +import datetime import errno import json import os @@ -35,17 +36,15 @@ import stat import subprocess import threading import time -import datetime from contextlib import contextmanager from hashlib import md5 from importlib import import_module from itertools import groupby from random import getrandbits -from tempfile import TemporaryDirectory, NamedTemporaryFile +from tempfile import NamedTemporaryFile, TemporaryDirectory import vobject - if os.name == "nt": import ctypes import ctypes.wintypes @@ -178,7 +177,7 @@ def path_to_filesystem(root, *paths): # Check for conflicting files (e.g. case-insensitive file systems # or short names on Windows file systems) if os.path.lexists(safe_path): - if not part in os.listdir(safe_path_parent): + if part not in os.listdir(safe_path_parent): raise CollidingPathError(part) return safe_path @@ -826,7 +825,7 @@ class Collection(BaseCollection): if cls._waiters: cls._waiters[0].notify() if (cls.configuration.getboolean( - "storage", "filesystem_close_lock_file") - and cls._readers == 0 and not cls._waiters): + "storage", "filesystem_close_lock_file") and + cls._readers == 0 and not cls._waiters): cls._lock_file.close() cls._lock_file = None diff --git a/radicale/tests/test_base.py b/radicale/tests/test_base.py index e9360b5..3dd6826 100644 --- a/radicale/tests/test_base.py +++ b/radicale/tests/test_base.py @@ -211,7 +211,8 @@ class BaseRequestsMixIn: assert status == 207 assert "href>/%s%s%s