diff --git a/dandi/support/tests/test_cache.py b/dandi/support/tests/test_cache.py index 1e5f3d417..f60b0d251 100644 --- a/dandi/support/tests/test_cache.py +++ b/dandi/support/tests/test_cache.py @@ -5,6 +5,7 @@ import time from dandi.support.cache import PersistentCache +from dandi.utils import on_windows import pytest @@ -141,15 +142,18 @@ def check_new_memoread(arg, content, expect_new=False): check_new_memoread(0, "Content") # Check that symlinks should be dereferenced - symlink1 = str(tmp_path / (fname + ".link1")) - try: - os.symlink(fname, symlink1) - except OSError: - pass - if op.islink(fname): # hopefully would just skip Windows if not supported - ncalls = len(calls) - assert memoread(symlink1, 0) == "Content" - assert len(calls) == ncalls # no new call + if not on_windows or sys.version_info[:2] >= (3, 8): + # realpath doesn't work right on Windows on pre-3.8 Python, so skip the + # test then. + symlink1 = str(tmp_path / (fname + ".link1")) + try: + os.symlink(fname, symlink1) + except OSError: + pass + if op.islink(symlink1): # hopefully would just skip Windows if not supported + ncalls = len(calls) + assert memoread(symlink1, 0) == "Content" + assert len(calls) == ncalls # no new call # and if we "clear", would it still work? cache.clear()