From 40f1b2eccfc27764e49b20bf712d4f5fa321fcac Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sun, 22 Jun 2025 18:31:46 +0200 Subject: fix: tests during Nix build Fixes the following error when executing the tests during a Nix build: Traceback (most recent call last): File "/build/inkstitch/lib/elements/element.py", line 714, in handle_unexpected_exceptions yield File "/build/inkstitch/lib/elements/element.py", line 650, in embroider stitch_groups = self._load_cached_stitch_groups(previous_stitch, next_element) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/inkstitch/lib/debug/debug.py", line 172, in decorated result = func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/build/inkstitch/lib/elements/element.py", line 541, in _load_cached_stitch_groups stitch_groups = get_stitch_plan_cache().get(cache_key) ^^^^^^^^^^^^^^^^^^^^^^^ File "/build/inkstitch/lib/utils/cache.py", line 31, in get_stitch_plan_cache cache_dir = get_user_dir('cache') ^^^^^^^^^^^^^^^^^^^^^ File "/build/inkstitch/lib/utils/paths.py", line 50, in get_user_dir os.makedirs(path) File "", line 215, in makedirs File "", line 215, in makedirs File "", line 225, in makedirs PermissionError: [Errno 13] Permission denied: '/homeless-shelter' --- tests/conftest.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/conftest.py (limited to 'tests/conftest.py') 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 -- cgit v1.2.3