Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b66be7c

Browse filesBrowse files
committed
Replace xfail with gc.collect in TestSubmodule.test_rename
Like the xfail was, this is conditional, being done only in the specific situation the PermissionError occurs. Besides that it does not always run even on Windows (only in 3.12 and later), this resembles various other conditional and non-conditional gc.collect calls. It had previously appeared to me that two calls to gc.collect were required, but I am unable to reproduce that. It may have been specific to how I was running it on my system at that time. The need for only one call may have been brought about by changes to the code in the mean time, but I have tested that only one call appears required even without the changes in #1765.
1 parent f62df52 commit b66be7c
Copy full SHA for b66be7c

File tree

1 file changed

+6
-0
lines changed
Filter options

1 file changed

+6
-0
lines changed

‎test/test_submodule.py

Copy file name to clipboardExpand all lines: test/test_submodule.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,12 @@ def test_rename(self, rwdir):
958958
assert sm.rename(sm_name) is sm and sm.name == sm_name
959959
assert not sm.repo.is_dirty(index=True, working_tree=False, untracked_files=False)
960960

961+
# This is needed to work around a PermissionError on Windows, resembling others,
962+
# except new in Python 3.12. (*Maybe* this could be due to changes in CPython's
963+
# garbage collector detailed in https://github.com/python/cpython/issues/97922.)
964+
if os.name == "nt" and sys.version_info >= (3, 12):
965+
gc.collect()
966+
961967
new_path = "renamed/myname"
962968
assert sm.move(new_path).name == new_path
963969

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.