Skip to content

Consider making fscacher.test self-contained #100

@hosiet

Description

@hosiet

I was trying to solve the issue discussed in https://bugs.debian.org/1079398#10 . For Debian's autopkgtest infra to work properly, the following patch will be needed, as discussed in https://lists.debian.org/debian-python/2024/11/msg00016.html :

--- fscacher-0.4.1.orig/src/fscacher/tests/test_cache.py
+++ fscacher-0.4.1/src/fscacher/tests/test_cache.py
@@ -8,8 +8,8 @@ import subprocess
 import sys
 import time
 import pytest
-from .. import PersistentCache
-from ..cache import DirFingerprint, FileFingerprint
+from fscacher import PersistentCache
+from fscacher.cache import DirFingerprint, FileFingerprint

 platform_system = platform.system().lower()
 on_windows = platform_system == "windows"
--- fscacher-0.4.1.orig/src/fscacher/tests/test_util.py
+++ fscacher-0.4.1/src/fscacher/tests/test_util.py
@@ -1,5 +1,5 @@
 import pytest
-from ..cache import xor_bytes
+from fscacher.cache import xor_bytes


 @pytest.mark.parametrize(

I believe the logic is that tests should be self-contained, and not a subpackage under the fscacher namespace that utilizes relative import. Now I am wondering if that patch makes sense to you.

Besides, with this patch, the /src/fscacher/tests/ directory can also be moved to the top dir and not nested under /src/fscacher/. That is just a wishlist item and you can decide whether that is useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions