summaryrefslogtreecommitdiff
path: root/tests/test_metadata.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_metadata.py')
-rw-r--r--tests/test_metadata.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/test_metadata.py b/tests/test_metadata.py
index 62152f5..c719b4d 100644
--- a/tests/test_metadata.py
+++ b/tests/test_metadata.py
@@ -16,6 +16,15 @@ def get_version_value_cargo():
16 return parse_version(cargo_toml["package"]["version"]) 16 return parse_version(cargo_toml["package"]["version"])
17 17
18 18
19def get_version_values_pyproject():
20 with open("pyproject.toml", encoding="utf-8") as f:
21 pyproject_toml = toml.loads(f.read())
22 return [
23 parse_version(pyproject_toml["project"]["version"]),
24 parse_version(pyproject_toml["tool"]["poetry"]["version"]),
25 ]
26
27
19def get_version_value_changelog(): 28def get_version_value_changelog():
20 """ 29 """
21 Try to get the names of all classes that we added to the Python module 30 Try to get the names of all classes that we added to the Python module
@@ -37,15 +46,18 @@ def get_version_value_changelog():
37 46
38def test_version_numbers_all_same(): 47def test_version_numbers_all_same():
39 """ 48 """
40 Makes sure that `Cargo.toml` and `CHANGELOG.md` contain the same version 49 Makes sure that `pyproject.toml`, `Cargo.toml` and `CHANGELOG.md` contain
41 number as the one attached to the `adblock` module. 50 the same version number as the one attached to the `adblock` module.
42 """ 51 """
43 cargo_version = get_version_value_cargo() 52 cargo_version = get_version_value_cargo()
44 changelog_version = get_version_value_changelog() 53 changelog_version = get_version_value_changelog()
54 pyproject_versions = get_version_values_pyproject()
45 module_version = parse_version(adblock.__version__) 55 module_version = parse_version(adblock.__version__)
46 56
47 assert cargo_version == module_version 57 assert cargo_version == module_version
48 assert module_version == changelog_version 58 assert module_version == changelog_version
59 assert changelog_version == pyproject_versions[0]
60 assert pyproject_versions[0] == pyproject_versions[1]
49 61
50 62
51def get_current_python_version(): 63def get_current_python_version():