Patch-Source: https://github.com/Kozea/Radicale/pull/1429.patch
--
From c6faffdf3a05a9300179fb29f6c77ae92d0b4565 Mon Sep 17 00:00:00 2001
From: Peter Bieringer <pb@bieringer.de>
Date: Tue, 12 Mar 2024 08:02:24 +0100
Subject: [PATCH] fix for pytest warning: "is using nose-specific method:
 `setup(self)`"

---
 radicale/tests/__init__.py     |  4 ++--
 radicale/tests/test_base.py    |  4 ++--
 radicale/tests/test_config.py  |  4 ++--
 radicale/tests/test_server.py  |  8 ++++----
 radicale/tests/test_storage.py | 16 ++++++++--------
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/radicale/tests/__init__.py b/radicale/tests/__init__.py
index 942cbe89..63cfda04 100644
--- a/radicale/tests/__init__.py
+++ b/radicale/tests/__init__.py
@@ -48,7 +48,7 @@ class BaseTest:
     configuration: config.Configuration
     application: app.Application
 
-    def setup(self) -> None:
+    def setup_method(self) -> None:
         self.configuration = config.load()
         self.colpath = tempfile.mkdtemp()
         self.configure({
@@ -62,7 +62,7 @@ def configure(self, config_: types.CONFIG) -> None:
         self.configuration.update(config_, "test", privileged=True)
         self.application = app.Application(self.configuration)
 
-    def teardown(self) -> None:
+    def teardown_method(self) -> None:
         shutil.rmtree(self.colpath)
 
     def request(self, method: str, path: str, data: Optional[str] = None,
diff --git a/radicale/tests/test_base.py b/radicale/tests/test_base.py
index a0d3d534..5f600622 100644
--- a/radicale/tests/test_base.py
+++ b/radicale/tests/test_base.py
@@ -37,8 +37,8 @@ class TestBaseRequests(BaseTest):
     # Allow skipping sync-token tests, when not fully supported by the backend
     full_sync_token_support: ClassVar[bool] = True
 
-    def setup(self) -> None:
-        BaseTest.setup(self)
+    def setup_method(self) -> None:
+        BaseTest.setup_method(self)
         rights_file_path = os.path.join(self.colpath, "rights")
         with open(rights_file_path, "w") as f:
             f.write("""\
diff --git a/radicale/tests/test_config.py b/radicale/tests/test_config.py
index 32a87ec2..92ece9a6 100644
--- a/radicale/tests/test_config.py
+++ b/radicale/tests/test_config.py
@@ -31,10 +31,10 @@ class TestConfig:
 
     colpath: str
 
-    def setup(self) -> None:
+    def setup_method(self) -> None:
         self.colpath = tempfile.mkdtemp()
 
-    def teardown(self) -> None:
+    def teardown_method(self) -> None:
         shutil.rmtree(self.colpath)
 
     def _write_config(self, config_dict: types.CONFIG, name: str) -> str:
diff --git a/radicale/tests/test_server.py b/radicale/tests/test_server.py
index 67ce10d4..ecc493a4 100644
--- a/radicale/tests/test_server.py
+++ b/radicale/tests/test_server.py
@@ -54,8 +54,8 @@ class TestBaseServerRequests(BaseTest):
     thread: threading.Thread
     opener: request.OpenerDirector
 
-    def setup(self) -> None:
-        super().setup()
+    def setup_method(self) -> None:
+        super().setup_method()
         self.shutdown_socket, shutdown_socket_out = socket.socketpair()
         with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
             # Find available port
@@ -74,13 +74,13 @@ def setup(self) -> None:
             request.HTTPSHandler(context=ssl_context),
             DisabledRedirectHandler)
 
-    def teardown(self) -> None:
+    def teardown_method(self) -> None:
         self.shutdown_socket.close()
         try:
             self.thread.join()
         except RuntimeError:  # Thread never started
             pass
-        super().teardown()
+        super().teardown_method()
 
     def request(self, method: str, path: str, data: Optional[str] = None,
                 check: Optional[int] = None, **kwargs
diff --git a/radicale/tests/test_storage.py b/radicale/tests/test_storage.py
index 35479e98..9072a354 100644
--- a/radicale/tests/test_storage.py
+++ b/radicale/tests/test_storage.py
@@ -35,8 +35,8 @@
 class TestMultiFileSystem(BaseTest):
     """Tests for multifilesystem."""
 
-    def setup(self) -> None:
-        _TestBaseRequests.setup(cast(_TestBaseRequests, self))
+    def setup_method(self) -> None:
+        _TestBaseRequests.setup_method(cast(_TestBaseRequests, self))
         self.configure({"storage": {"type": "multifilesystem"}})
 
     def test_folder_creation(self) -> None:
@@ -150,8 +150,8 @@ def test_put_whole_addressbook_random_uids_used_as_file_names(
 class TestMultiFileSystemNoLock(BaseTest):
     """Tests for multifilesystem_nolock."""
 
-    def setup(self) -> None:
-        _TestBaseRequests.setup(cast(_TestBaseRequests, self))
+    def setup_method(self) -> None:
+        _TestBaseRequests.setup_method(cast(_TestBaseRequests, self))
         self.configure({"storage": {"type": "multifilesystem_nolock"}})
 
     test_add_event = _TestBaseRequests.test_add_event
@@ -161,8 +161,8 @@ def setup(self) -> None:
 class TestCustomStorageSystem(BaseTest):
     """Test custom backend loading."""
 
-    def setup(self) -> None:
-        _TestBaseRequests.setup(cast(_TestBaseRequests, self))
+    def setup_method(self) -> None:
+        _TestBaseRequests.setup_method(cast(_TestBaseRequests, self))
         self.configure({"storage": {
             "type": "radicale.tests.custom.storage_simple_sync"}})
 
@@ -181,8 +181,8 @@ def setup(self) -> None:
 class TestCustomStorageSystemCallable(BaseTest):
     """Test custom backend loading with ``callable``."""
 
-    def setup(self) -> None:
-        _TestBaseRequests.setup(cast(_TestBaseRequests, self))
+    def setup_method(self) -> None:
+        _TestBaseRequests.setup_method(cast(_TestBaseRequests, self))
         self.configure({"storage": {
             "type": radicale.tests.custom.storage_simple_sync.Storage}})
 
