diff options
Diffstat (limited to 'tests/test_version_numbers.py')
| -rw-r--r-- | tests/test_version_numbers.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/tests/test_version_numbers.py b/tests/test_version_numbers.py deleted file mode 100644 index 77db2f5..0000000 --- a/tests/test_version_numbers.py +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | import subprocess | ||
| 2 | |||
| 3 | import toml | ||
| 4 | import adblock | ||
| 5 | |||
| 6 | |||
| 7 | def get_version_value_poetry(): | ||
| 8 | with open("pyproject.toml", encoding="utf-8") as f: | ||
| 9 | pyproject_toml = toml.loads(f.read()) | ||
| 10 | return pyproject_toml["tool"]["poetry"]["version"] | ||
| 11 | |||
| 12 | |||
| 13 | def get_version_value_cargo(): | ||
| 14 | with open("Cargo.toml", encoding="utf-8") as f: | ||
| 15 | cargo_toml = toml.loads(f.read()) | ||
| 16 | return cargo_toml["package"]["version"] | ||
| 17 | |||
| 18 | |||
| 19 | def get_version_value_changelog(): | ||
| 20 | try: | ||
| 21 | proc = subprocess.Popen(["changelog", "current"], stdout=subprocess.PIPE) | ||
| 22 | except FileNotFoundError: | ||
| 23 | return None | ||
| 24 | assert proc.wait() == 0 | ||
| 25 | return proc.stdout.read().decode("utf-8").strip() | ||
| 26 | |||
| 27 | |||
| 28 | def test_version_numbers_all_same(): | ||
| 29 | """ | ||
| 30 | Makes sure that `pyproject.toml`, `Cargo.toml`, and `CHANGELOG.md` contain | ||
| 31 | the same version number as the one attached to the `adblock` module. | ||
| 32 | """ | ||
| 33 | cargo_version = get_version_value_cargo() | ||
| 34 | poetry_version = get_version_value_poetry() | ||
| 35 | changelog_version = get_version_value_changelog() | ||
| 36 | module_version = adblock.__version__ | ||
| 37 | |||
| 38 | assert cargo_version == poetry_version | ||
| 39 | assert poetry_version == module_version | ||
| 40 | assert changelog_version is None or module_version == changelog_version | ||
