Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Chore: Remove unused test helpers (#14166)

Trenton Hd02d1e171129
diff --git a/src/documents/tests/conftest.py b/src/documents/tests/conftest.py
index 626760d31..fe868b249 100644
--- a/src/documents/tests/conftest.py
+++ b/src/documents/tests/conftest.py
@@ -1,5 +1,4 @@
import shutil
-import zoneinfo
from collections.abc import Generator
from dataclasses import dataclass
from pathlib import Path
@@ -117,11 +116,6 @@ def _search_index(
reset_backend()
-def settings_timezone(settings: Settings) -> zoneinfo.ZoneInfo:
- return zoneinfo.ZoneInfo(settings.TIME_ZONE)
-
-
@pytest.fixture
def rest_api_client():
"""
diff --git a/src/documents/tests/utils.py b/src/documents/tests/utils.py
index 7e08b65a8..d699ccf5e 100644
--- a/src/documents/tests/utils.py
+++ b/src/documents/tests/utils.py
@@ -196,20 +196,6 @@ class FileSystemAssertsMixin:
def assertIsNotDir(self, path: PathLike[str] | str) -> None:
self.assertFalse(Path(path).resolve().is_dir(), f"Dir does exist: {path}")
- def assertFilesEqual(
- self,
- path1: PathLike[str] | str,
- path2: PathLike[str] | str,
- ) -> None:
- path1 = Path(path1)
- path2 = Path(path2)
- import hashlib
-
- hash1 = hashlib.sha256(path1.read_bytes()).hexdigest()
- hash2 = hashlib.sha256(path2.read_bytes()).hexdigest()
-
- self.assertEqual(hash1, hash2, "File SHA256 mismatch")
-
def assertFileCountInDir(self, path: PathLike[str] | str, count: int) -> None:
path = Path(path).resolve()
self.assertTrue(path.is_dir(), f"Path {path} is not a directory")
@@ -221,24 +207,6 @@ class FileSystemAssertsMixin:
)
-class ConsumerProgressMixin:
- """
- Mocks the Consumer _send_progress, preventing attempts to connect to Redis
- and allowing access to its calls for verification
- """
-
- def setUp(self) -> None:
- self.send_progress_patcher = mock.patch(
- "documents.consumer.Consumer._send_progress",
- )
- self.send_progress_mock = self.send_progress_patcher.start()
- super().setUp()
-
- def tearDown(self) -> None:
- super().tearDown()
- self.send_progress_patcher.stop()
-
-
class ConsumeTaskMixin:
"""
Provides mocking of the consume_file asynchronous task and useful utilities
@@ -282,7 +250,6 @@ class TestMigrations(TransactionTestCase):
migrate_from = None
dependencies = None
migrate_to = None
- auto_migrate = True
def setUp(self) -> None:
super().setUp()
@@ -304,10 +271,6 @@ class TestMigrations(TransactionTestCase):
self.apps = old_apps
- if self.auto_migrate:
- self.performMigration()
-
- def performMigration(self) -> None:
# Run the migration to test
executor = MigrationExecutor(connection)
executor.loader.build_graph() # reload.