summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py8
-rw-r--r--tests/test_clone.py11
2 files changed, 8 insertions, 11 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 00000000..c4e58897
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,8 @@
+import pytest
+
+import lib.utils.settings
+
+@pytest.fixture(scope="session", autouse=True)
+def disable_cache():
+ # We disable the cache because Nix executes our tests with a non-writable HOME directory.
+ lib.utils.settings.global_settings._settings['cache_size'] = 0
diff --git a/tests/test_clone.py b/tests/test_clone.py
index 4b4cf101..ba6784e1 100644
--- a/tests/test_clone.py
+++ b/tests/test_clone.py
@@ -9,7 +9,6 @@ from inkex.tester.svg import svg
from lib.commands import add_commands
from lib.elements import Clone, EmbroideryElement, FillStitch
from lib.svg.tags import INKSCAPE_LABEL, INKSTITCH_ATTRIBS, SVG_RECT_TAG
-from lib.utils import cache_module
from .utils import element_count
@@ -22,16 +21,6 @@ def element_fill_angle(element: EmbroideryElement) -> Optional[float]:
class CloneElementTest(TestCase):
- # Monkey-patch the cahce to forcibly disable it: We may need to refactor this out for tests.
- def setUp(self) -> None:
- from pytest import MonkeyPatch
- self.monkeypatch = MonkeyPatch()
- self.monkeypatch.setattr(cache_module, "is_cache_disabled", lambda: True)
-
- def tearDown(self) -> None:
- self.monkeypatch.undo()
- return super().tearDown()
-
def assertAngleAlmostEqual(self, a, b) -> None:
# Take the mod 180 of the returned angles, because e.g. -130deg and 50deg produce fills along the same angle.
# We have to use a precision of 4 decimal digits because of the precision of the matrices as they are stored in the svg trees