Merge setup.cfg and pytest.ini, fix tests

This commit is contained in:
Guillaume Ayoub 2017-04-15 10:51:00 +02:00
parent 26d8214296
commit 864eb5931a
8 changed files with 26 additions and 24 deletions

View File

@ -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

View File

@ -27,5 +27,4 @@ Launch the server according to configuration and command-line options.
import radicale.__main__ import radicale.__main__
radicale.__main__.run() radicale.__main__.run()

View File

@ -28,6 +28,7 @@ should have been included in this package.
import base64 import base64
import contextlib import contextlib
import datetime
import io import io
import itertools import itertools
import os import os
@ -41,7 +42,6 @@ import threading
import traceback import traceback
import wsgiref.simple_server import wsgiref.simple_server
import zlib import zlib
import datetime
from http import client from http import client
from urllib.parse import unquote, urlparse from urllib.parse import unquote, urlparse
@ -49,7 +49,6 @@ import vobject
from . import auth, rights, storage, xmlutils from . import auth, rights, storage, xmlutils
VERSION = "2.0.0rc0" VERSION = "2.0.0rc0"
NOT_ALLOWED = ( NOT_ALLOWED = (
@ -125,7 +124,8 @@ class HTTPServer(wsgiref.simple_server.WSGIServer):
self.logger.error("connection timeout") self.logger.error("connection timeout")
else: else:
self.logger.error( 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): class HTTPSServer(HTTPServer):

View File

@ -33,8 +33,8 @@ import sys
from wsgiref.simple_server import make_server from wsgiref.simple_server import make_server
from . import ( from . import (
VERSION, Application, RequestHandler, ThreadedHTTPServer, VERSION, Application, RequestHandler, ThreadedHTTPServer,
ThreadedHTTPSServer, config, log) ThreadedHTTPSServer, config, log)
def run(): def run():

View File

@ -26,6 +26,7 @@ entry.
""" """
import contextlib import contextlib
import datetime
import errno import errno
import json import json
import os import os
@ -35,17 +36,15 @@ import stat
import subprocess import subprocess
import threading import threading
import time import time
import datetime
from contextlib import contextmanager from contextlib import contextmanager
from hashlib import md5 from hashlib import md5
from importlib import import_module from importlib import import_module
from itertools import groupby from itertools import groupby
from random import getrandbits from random import getrandbits
from tempfile import TemporaryDirectory, NamedTemporaryFile from tempfile import NamedTemporaryFile, TemporaryDirectory
import vobject import vobject
if os.name == "nt": if os.name == "nt":
import ctypes import ctypes
import ctypes.wintypes import ctypes.wintypes
@ -178,7 +177,7 @@ def path_to_filesystem(root, *paths):
# Check for conflicting files (e.g. case-insensitive file systems # Check for conflicting files (e.g. case-insensitive file systems
# or short names on Windows file systems) # or short names on Windows file systems)
if os.path.lexists(safe_path): 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) raise CollidingPathError(part)
return safe_path return safe_path
@ -826,7 +825,7 @@ class Collection(BaseCollection):
if cls._waiters: if cls._waiters:
cls._waiters[0].notify() cls._waiters[0].notify()
if (cls.configuration.getboolean( if (cls.configuration.getboolean(
"storage", "filesystem_close_lock_file") "storage", "filesystem_close_lock_file") and
and cls._readers == 0 and not cls._waiters): cls._readers == 0 and not cls._waiters):
cls._lock_file.close() cls._lock_file.close()
cls._lock_file = None cls._lock_file = None

View File

@ -211,7 +211,8 @@ class BaseRequestsMixIn:
assert status == 207 assert status == 207
assert "href>/</" in answer assert "href>/</" in answer
assert "href>%s</" % calendar_path in answer assert "href>%s</" % calendar_path in answer
status, headers, answer = self.request("PROPFIND", calendar_path, HTTP_DEPTH="1") status, headers, answer = self.request(
"PROPFIND", calendar_path, HTTP_DEPTH="1")
assert status == 207 assert status == 207
assert "href>%s</" % calendar_path in answer assert "href>%s</" % calendar_path in answer
assert "href>%s</" % event_path in answer assert "href>%s</" % event_path in answer

View File

@ -35,7 +35,6 @@ from urllib.parse import quote, unquote, urlparse
from . import storage from . import storage
MIMETYPES = { MIMETYPES = {
"VADDRESSBOOK": "text/vcard", "VADDRESSBOOK": "text/vcard",
"VCALENDAR": "text/calendar"} "VCALENDAR": "text/calendar"}
@ -623,7 +622,7 @@ def _propfind_response(base_prefix, path, item, props, user, write=False,
prop200.append(ET.Element(_tag("C", "calendar-timezone"))) prop200.append(ET.Element(_tag("C", "calendar-timezone")))
prop200.append(ET.Element(_tag("D", "displayname"))) prop200.append(ET.Element(_tag("D", "displayname")))
prop200.append(ET.Element(_tag("ICAL", "calendar-color"))) prop200.append(ET.Element(_tag("ICAL", "calendar-color")))
prop200.append(ET.Element(_tag("D", "owner"))) prop200.append(ET.Element(_tag("D", "owner")))
if is_leaf: if is_leaf:
meta = item.get_meta() meta = item.get_meta()
@ -681,9 +680,11 @@ def _propfind_response(base_prefix, path, item, props, user, write=False,
privilege.append(ET.Element(_tag(ns, privilege_name))) privilege.append(ET.Element(_tag(ns, privilege_name)))
element.append(privilege) element.append(privilege)
elif tag == _tag("D", "supported-report-set"): elif tag == _tag("D", "supported-report-set"):
reports = [("D", "expand-property"), # not implemented # These 3 reports are not implemented
("D", "principal-search-property-set"), # not implemented reports = [
("D", "principal-property-search")] # not implemented ("D", "expand-property"),
("D", "principal-search-property-set"),
("D", "principal-property-search")]
if is_collection and is_leaf: if is_collection and is_leaf:
reports.append(("D", "sync-collection")) reports.append(("D", "sync-collection"))
if item.get_meta("tag") == "VADDRESSBOOK": if item.get_meta("tag") == "VADDRESSBOOK":

View File

@ -1,2 +1,9 @@
[aliases] [aliases]
test=pytest test = pytest
[bdist_wheel]
python-tag = py3
[tool:pytest]
addopts = --flake8 --isort --cov radicale
norecursedirs = dist .cache .git build *.egg-info .eggs venv