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

Commita8f109c

Browse files
committed
Fix exception in Popen.__del__ in test on Windows
The newly introduced test would pass, but show: Exception ignored in: <function Popen.__del__ at 0x000002483DE14900> Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1130, in __del__ self._internal_poll(_deadstate=_maxsize) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 1575, in _internal_poll if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [WinError 6] The handle is invalidThis was due to how, at least for now, the deprecation warningtests are not using GitPython's normal fixtures, which help cleanthings up on Windows.This adds a small amount of ad-hoc cleanup. It also moves theacquisition of the Diff object into a pytest fixture, which can bereused for the immediately forthcoming test that the preferredproperty does not warn.
1 parente7dec7d commita8f109c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎test/deprecation/test_various.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,27 @@
33

44
"""Tests of assorted deprecation warnings with no extra subtleties to check."""
55

6-
fromgit.diffimportNULL_TREE
7-
fromgit.repoimportRepo
6+
importgc
87

98
importpytest
109

10+
fromgit.diffimportNULL_TREE
11+
fromgit.repoimportRepo
12+
1113

12-
deftest_diff_renamed_warns(tmp_path):
14+
@pytest.fixture
15+
defsingle_diff(tmp_path):
16+
"""Fixture to supply a single-file diff."""
1317
(tmp_path/"a.txt").write_text("hello\n",encoding="utf-8")
1418
repo=Repo.init(tmp_path)
1519
repo.index.add(["a.txt"])
1620
commit=repo.index.commit("Initial commit")
1721
(diff,)=commit.diff(NULL_TREE)# Exactly one file in the diff.
22+
yielddiff
23+
delrepo,commit,diff
24+
gc.collect()
25+
1826

27+
deftest_diff_renamed_warns(single_diff):
1928
withpytest.deprecated_call():
20-
diff.renamed
29+
single_diff.renamed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp