Skip to content

Commit b1b3495

Browse files
jsf9kmcdonnnj
andcommitted
Move test fixture to conftest.py
This fixture has session scope, so this is a better home for it. Co-authored-by: Nick M <[email protected]>
1 parent fead28f commit b1b3495

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

tests/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
# Third-Party Libraries
77
import pytest
88

9+
VERSION_FILE = "src/version.txt"
10+
11+
12+
@pytest.fixture(scope="session")
13+
def project_version():
14+
"""Return the version of the project."""
15+
with open(VERSION_FILE) as f:
16+
project_version = f.read().strip()
17+
return project_version
18+
919

1020
def pytest_addoption(parser):
1121
"""Add new commandline options to pytest."""

tests/test_version.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77
import pytest
88

99
GITHUB_RELEASE_TAG = os.getenv("GITHUB_RELEASE_TAG")
10-
VERSION_FILE = "src/version.txt"
11-
12-
13-
@pytest.fixture(scope="session")
14-
def project_version():
15-
"""Return the version of the project."""
16-
with open(VERSION_FILE) as f:
17-
project_version = f.read().strip()
18-
return project_version
1910

2011

2112
@pytest.mark.skipif(

0 commit comments

Comments
 (0)