Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Replace xfail with gc.collect in TestSubmodule.test_rename#1767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 2 commits intogitpython-developers:mainfromEliahKagan:312-gc
Dec 12, 2023
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletionstest/test_submodule.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -948,18 +948,6 @@ def test_remove_norefs(self, rwdir):
sm.remove()
assert not sm.exists()

@pytest.mark.xfail(
os.name == "nt" and sys.version_info >= (3, 12),
reason=(
"The sm.move call fails. Submodule.move calls os.renames, which raises:\n"
"PermissionError: [WinError 32] "
"The process cannot access the file because it is being used by another process: "
R"'C:\Users\ek\AppData\Local\Temp\test_renamekkbznwjp\parent\mymodules\myname' "
R"-> 'C:\Users\ek\AppData\Local\Temp\test_renamekkbznwjp\parent\renamed\myname'"
"\nThis resembles other Windows errors, but only occurs starting in Python 3.12."
),
raises=PermissionError,
)
@with_rw_directory
def test_rename(self, rwdir):
parent = git.Repo.init(osp.join(rwdir, "parent"))
Expand All@@ -970,6 +958,12 @@ def test_rename(self, rwdir):
assert sm.rename(sm_name) is sm and sm.name == sm_name
assert not sm.repo.is_dirty(index=True, working_tree=False, untracked_files=False)

# This is needed to work around a PermissionError on Windows, resembling others,
# except new in Python 3.12. (*Maybe* this could be due to changes in CPython's
# garbage collector detailed in https://github.com/python/cpython/issues/97922.)
if os.name == "nt" and sys.version_info >= (3, 12):
gc.collect()

new_path = "renamed/myname"
assert sm.move(new_path).name == new_path

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp