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__
radicale.__main__.run()

View File

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

View File

@ -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():

View File

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

View File

@ -211,7 +211,8 @@ class BaseRequestsMixIn:
assert status == 207
assert "href>/</" 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 "href>%s</" % calendar_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
MIMETYPES = {
"VADDRESSBOOK": "text/vcard",
"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("D", "displayname")))
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:
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)))
element.append(privilege)
elif tag == _tag("D", "supported-report-set"):
reports = [("D", "expand-property"), # not implemented
("D", "principal-search-property-set"), # not implemented
("D", "principal-property-search")] # not implemented
# These 3 reports are not implemented
reports = [
("D", "expand-property"),
("D", "principal-search-property-set"),
("D", "principal-property-search")]
if is_collection and is_leaf:
reports.append(("D", "sync-collection"))
if item.get_meta("tag") == "VADDRESSBOOK":

View File

@ -1,2 +1,9 @@
[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