File tree 1 file changed +15
-10
lines changed
1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change 13
13
14
14
15
15
@pytest .fixture
16
- def single_diff (tmp_path ):
17
- """Fixture to supply a single-file diff."""
18
- # TODO: Consider making a fake diff rather than using a real repo and commit.
16
+ def commit (tmp_path ):
17
+ """Fixture to supply a one-commit repo's commit, enough for deprecation tests."""
19
18
(tmp_path / "a.txt" ).write_text ("hello\n " , encoding = "utf-8" )
20
19
repo = Repo .init (tmp_path )
21
20
repo .index .add (["a.txt" ])
22
- commit = repo .index .commit ("Initial commit" )
21
+ yield repo .index .commit ("Initial commit" )
22
+ del repo
23
+ gc .collect ()
24
+
25
+
26
+ @pytest .fixture
27
+ def diff (commit ):
28
+ """Fixture to supply a single-file diff."""
29
+ # TODO: Consider making a fake diff rather than using a real repo and commit.
23
30
(diff ,) = commit .diff (NULL_TREE ) # Exactly one file in the diff.
24
31
yield diff
25
- del repo , commit , diff
26
- gc .collect ()
27
32
28
33
29
- def test_diff_renamed_warns (single_diff ):
34
+ def test_diff_renamed_warns (diff ):
30
35
"""The deprecated Diff.renamed property issues a deprecation warning."""
31
36
with pytest .deprecated_call ():
32
- single_diff .renamed
37
+ diff .renamed
33
38
34
39
35
- def test_diff_renamed_file_does_not_warn (single_diff ):
40
+ def test_diff_renamed_file_does_not_warn (diff ):
36
41
"""The preferred Diff.renamed_file property issues no deprecation warning."""
37
42
with warnings .catch_warnings ():
38
43
# FIXME: Refine this to filter for deprecation warnings from GitPython.
39
44
warnings .simplefilter ("error" , DeprecationWarning )
40
- single_diff .renamed_file
45
+ diff .renamed_file
You can’t perform that action at this time.
0 commit comments