Skip to content

Commit 03b35f2

Browse files
committed
Set scope more explicitly and write comment once on test class
1 parent 1845d48 commit 03b35f2

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

test/unit/util/release/changelog_test.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,27 @@
5858
)
5959

6060

61-
@pytest.fixture
61+
@pytest.fixture(scope="function")
6262
def changes_md(changelogs):
63-
"""
64-
As some operations in Changelogs modify files, we need a reset per function
65-
"""
6663
changelogs.changelog_md.write_text(CHANGES_CONTENTS)
6764

6865

69-
@pytest.fixture
66+
@pytest.fixture(scope="function")
7067
def unreleased_md(changelogs):
71-
"""
72-
As some operations in Changelogs modify files, we need a reset per function
73-
"""
7468
changelogs.unreleased_md.write_text(UNRELEASED_INITIAL_CONTENT + SHARED_TEXT)
7569

7670

77-
@pytest.fixture
71+
@pytest.fixture(scope="function")
7872
def changelogs(tmp_path) -> Changelogs:
79-
"""
80-
As some operations in Changelogs modify files, we need a reset per function
81-
"""
8273
return Changelogs(changes_path=tmp_path, version=Version(major=1, minor=0, patch=0))
8374

8475

8576
class TestChangelogs:
77+
"""
78+
As some methods in the class `Changelogs` modify files. The tests need to reset
79+
these fixtures per function.
80+
"""
81+
8682
@staticmethod
8783
def test_create_new_unreleased(changelogs):
8884
changelogs._create_new_unreleased()

0 commit comments

Comments
 (0)