Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork938
Description
Tested on
GitPython version: 1.0.2
Windows: Server 2012
Git: 2.7.0.windows
To reproduce
importosimportshutilfromgitimportRepopath_to_repo='somepath'r=Repo.init(path_to_repo)withfile(os.path.join(path_to_repo,'test.txt'),'a'):os.utime(os.path.join(path_to_repo,'test.txt'),None)r.index.add(['test.txt'])r.index.commit('Test commit')shutil.rmtree(path_to_repo)
you'll seWindowsError: [Error 32] The process cannot access the file because it is being used by another process:
Also you'll see that there are four git subprocesses running until python process will be closed (I was using REPL and this subprocesses were hanging there until I closed REPL).
They aregit cat-file --batch-check
andgit cat-file --batch
.
On macos calling this example in REPL leads to appearing of two non finished git-processes too.
Process Explorer show that the folder (path_to_repo
) is locked by 4 git processes.
Maybe there is concept that Repo should be closed somehow but i could not find that kind of API.
Some GitPython-tests fails with this error (tests run on master branch):
======================================================================ERROR: test_commit_serialization (git.test.performance.test_commit.TestPerformance)----------------------------------------------------------------------Traceback (most recent call last): File "D:\gp\git\test\performance\lib.py", line 89, in tearDown shutil.rmtree(self.gitrwrepo.working_dir) File "c:\python27\Lib\shutil.py", line 256, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "c:\python27\Lib\shutil.py", line 254, in rmtree os.rmdir(path)WindowsError: [Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\me\\appdata\\local\\temp\\3\\tmpdjaibf'-------------------- >> begin captured logging << --------------------root: INFO: You can set the GIT_PYTHON_TEST_GIT_REPO_BASE environment variable to a .git repository ofyour choice - defaulting to the gitpython repository--------------------- >> end captured logging << ---------------------======================================================================ERROR: test_large_data_streaming (git.test.performance.test_streams.TestObjDBPerformance)----------------------------------------------------------------------Traceback (most recent call last): File "D:\gp\git\test\lib\helper.py", line 121, in repo_creator return func(self, rw_repo) File "D:\gp\git\test\performance\test_streams.py", line 90, in test_large_data_streaming os.remove(db_file)WindowsError: [Error 32] The process cannot access the file because it is being used by another process: u'c:\\users\\me\\appdata\\local\\temp\\3\\tmpnylxewbare_test_large_data_streaming\\objects\\81\\7bd0459ba45c7186b5279fbacc69dc39c42efb'-------------------- >> begin captured logging << --------------------root: INFO: You can set the GIT_PYTHON_TEST_GIT_REPO_BASE environment variable to a .git repository ofyour choice - defaulting to the gitpython repository--------------------- >> end captured logging << ---------------------
P.S. I know it is a problem to test on windows platform. My colleague mentioned AppVeyor CI for windows CI.Pip-accel is using it.