Skip to content

Commit 3032935

Browse files
committed
Skip Test on Windows
Currently renaming files is not supported while the the OS doesn't support renaming open files. When closing the file, as done in the code by using http://smmap.readthedocs.io/en/latest/api.html#smmap.mman.StaticWindowMapManager.force_map_handle_removal_win force_map_handle_removal_win, we can rename, but the cache does still have a handle to this file and crashes.
1 parent fd2eba4 commit 3032935

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gitdb/test/db/test_pack.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@
1010
from gitdb.db import PackedDB
1111

1212
from gitdb.exc import BadObject, AmbiguousObjectName
13+
from gitdb.util import mman
1314

1415
import os
1516
import random
17+
import sys
1618

19+
from unittest import skipIf
1720

1821
class TestPackDB(TestDBBase):
1922

23+
@skipIf(sys.platform == "win32", "not supported on windows currently")
2024
@with_rw_directory
2125
@with_packs_rw
2226
def test_writing(self, path):
@@ -30,6 +34,11 @@ def test_writing(self, path):
3034
# packs removed - rename a file, should affect the glob
3135
pack_path = pdb.entities()[0].pack().path()
3236
new_pack_path = pack_path + "renamed"
37+
if sys.platform == "win32":
38+
# This is just the beginning: While using thsi function, we are not
39+
# allowed to have any handle to thsi path, which is currently not
40+
# the case. The pack caching does have a handle :-(
41+
mman.force_map_handle_removal_win(pack_path)
3342
os.rename(pack_path, new_pack_path)
3443

3544
pdb.update_cache(force=True)

0 commit comments

Comments
 (0)