Skip to content

Commit b998ab6

Browse files
committed
Skip SafeFileCache no_perms tests on windows
Since Windows is lacking geteuid, it is useless.
1 parent b47c144 commit b998ab6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/unit/test_download.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ def test_unpack_file_url_thats_a_dir(self, tmpdir, data):
258258

259259

260260
class TestSafeFileCache:
261+
"""
262+
The no_perms test are useless on Windows since SafeFileCache uses
263+
pip.utils.filesystem.check_path_owner which is based on os.geteuid
264+
which is absent on Windows.
265+
"""
261266

262267
def test_cache_roundtrip(self, tmpdir):
263268
cache_dir = tmpdir.join("test-cache")
@@ -270,6 +275,7 @@ def test_cache_roundtrip(self, tmpdir):
270275
cache.delete("test key")
271276
assert cache.get("test key") is None
272277

278+
@pytest.mark.skipif("sys.platform == 'win32'")
273279
def test_safe_get_no_perms(self, tmpdir, monkeypatch):
274280
cache_dir = tmpdir.join("unreadable-cache")
275281
cache_dir.makedirs()
@@ -280,14 +286,16 @@ def test_safe_get_no_perms(self, tmpdir, monkeypatch):
280286
cache = SafeFileCache(cache_dir)
281287
cache.get("foo")
282288

289+
@pytest.mark.skipif("sys.platform == 'win32'")
283290
def test_safe_set_no_perms(self, tmpdir):
284291
cache_dir = tmpdir.join("unreadable-cache")
285292
cache_dir.makedirs()
286293
os.chmod(cache_dir, 000)
287294

288295
cache = SafeFileCache(cache_dir)
289-
cache.set("foo", "bar")
296+
cache.set("foo", b"bar")
290297

298+
@pytest.mark.skipif("sys.platform == 'win32'")
291299
def test_safe_delete_no_perms(self, tmpdir):
292300
cache_dir = tmpdir.join("unreadable-cache")
293301
cache_dir.makedirs()

0 commit comments

Comments
 (0)