Tests: Use absolute imports

This commit is contained in:
Unrud 2020-01-15 18:44:00 +01:00
parent 428e4be0b8
commit ed72e697de
7 changed files with 13 additions and 21 deletions

View File

@ -48,8 +48,6 @@ def finish_request_cov(self, request, client_address):
server.ParallelHTTPServer.finish_request = finish_request_cov
# Allow importing of tests.custom....
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
# Enable debug output
radicale.log.logger.setLevel(logging.DEBUG)

View File

@ -29,8 +29,7 @@ import tempfile
import pytest
from radicale import Application, config
from .test_base import BaseTest
from radicale.tests.test_base import BaseTest
class TestBaseAuthRequests(BaseTest):
@ -162,7 +161,7 @@ class TestBaseAuthRequests(BaseTest):
def test_custom(self):
"""Custom authentication."""
self.configuration.update(
{"auth": {"type": "tests.custom.auth"}}, "test")
{"auth": {"type": "radicale.tests.custom.auth"}}, "test")
self.application = Application(self.configuration)
status, _, answer = self.request(
"PROPFIND", "/tmp", HTTP_AUTHORIZATION="Basic %s" %

View File

@ -32,9 +32,8 @@ from functools import partial
import pytest
from radicale import Application, config, storage
from . import BaseTest
from .helpers import get_file_content
from radicale.tests import BaseTest
from radicale.tests.helpers import get_file_content
class BaseRequestsMixIn:
@ -1632,7 +1631,7 @@ class TestMultiFileSystem(BaseFileSystemTest, BaseRequestsMixIn):
class TestCustomStorageSystem(BaseFileSystemTest):
"""Test custom backend loading."""
storage_type = "tests.custom.storage_simple_sync"
storage_type = "radicale.tests.custom.storage_simple_sync"
full_sync_token_support = False
_report_sync_token = BaseRequestsMixIn._report_sync_token
test_root = BaseRequestsMixIn.test_root

View File

@ -22,8 +22,7 @@ from configparser import RawConfigParser
import pytest
from radicale import config
from .helpers import configuration_to_dict
from radicale.tests.helpers import configuration_to_dict
class TestConfig:

View File

@ -24,9 +24,8 @@ import shutil
import tempfile
from radicale import Application, config
from .helpers import get_file_content
from .test_base import BaseTest
from radicale.tests.helpers import get_file_content
from radicale.tests.test_base import BaseTest
class TestBaseRightsRequests(BaseTest):
@ -144,8 +143,8 @@ permissions: Rr""")
def test_custom(self):
"""Custom rights management."""
self._test_rights("tests.custom.rights", "", "/", "r", 401)
self._test_rights("tests.custom.rights", "", "/tmp", "r", 207)
self._test_rights("radicale.tests.custom.rights", "", "/", "r", 401)
self._test_rights("radicale.tests.custom.rights", "", "/tmp", "r", 207)
def test_collections_and_items(self):
"""Test rights for creation of collections, calendars and items.

View File

@ -35,8 +35,7 @@ from urllib.error import HTTPError, URLError
import pytest
from radicale import config, server
from .helpers import configuration_to_dict, get_file_path
from radicale.tests.helpers import configuration_to_dict, get_file_path
try:
import gunicorn

View File

@ -23,8 +23,7 @@ import shutil
import tempfile
from radicale import Application, config
from .test_base import BaseTest
from radicale.tests.test_base import BaseTest
class TestBaseWebRequests(BaseTest):
@ -62,7 +61,7 @@ class TestBaseWebRequests(BaseTest):
def test_custom(self):
"""Custom web plugin."""
self.configuration.update({
"web": {"type": "tests.custom.web"}}, "test")
"web": {"type": "radicale.tests.custom.web"}}, "test")
self.application = Application(self.configuration)
status, _, answer = self.request("GET", "/.web")
assert status == 200