File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change 1313
1414
1515@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."""
1918 (tmp_path / "a.txt" ).write_text ("hello\n " , encoding = "utf-8" )
2019 repo = Repo .init (tmp_path )
2120 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.
2330 (diff ,) = commit .diff (NULL_TREE ) # Exactly one file in the diff.
2431 yield diff
25- del repo , commit , diff
26- gc .collect ()
2732
2833
29- def test_diff_renamed_warns (single_diff ):
34+ def test_diff_renamed_warns (diff ):
3035 """The deprecated Diff.renamed property issues a deprecation warning."""
3136 with pytest .deprecated_call ():
32- single_diff .renamed
37+ diff .renamed
3338
3439
35- def test_diff_renamed_file_does_not_warn (single_diff ):
40+ def test_diff_renamed_file_does_not_warn (diff ):
3641 """The preferred Diff.renamed_file property issues no deprecation warning."""
3742 with warnings .catch_warnings ():
3843 # FIXME: Refine this to filter for deprecation warnings from GitPython.
3944 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