Skip to content

Commit fead28f

Browse files
jsf9kmcdonnnj
andcommitted
1 parent 6b79073 commit fead28f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/test_version.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,20 @@
1010
VERSION_FILE = "src/version.txt"
1111

1212

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
19+
20+
1321
@pytest.mark.skipif(
1422
GITHUB_RELEASE_TAG in [None, ""],
1523
reason="this is not a release (GITHUB_RELEASE_TAG not set)",
1624
)
17-
def test_release_version():
25+
def test_release_version(project_version):
1826
"""Verify that release tag version agrees with the module version."""
19-
pkg_vars = {}
20-
with open(VERSION_FILE) as f:
21-
exec(f.read(), pkg_vars) # nosec
22-
project_version = pkg_vars["__version__"]
2327
assert (
2428
GITHUB_RELEASE_TAG == f"v{project_version}"
2529
), "GITHUB_RELEASE_TAG does not match the project version"

0 commit comments

Comments
 (0)