1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
diff --git a/pyproject.toml b/pyproject.toml
index f5c293a..3c76d9b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -20,7 +20,7 @@ description = "Devtools Protocol implementation for chrome."
readme = "README.md"
requires-python = ">=3.8"
license = { "file" = "LICENSE.md" }
-dynamic = ["version"]
+version = "1.2.1"
authors = [
{name = "Andrew Pikul", email="ajpikul@gmail.com"},
{name = "Neyberson Atencio", email="neyberatencio@gmail.com"}
diff --git a/tests/conftest.py b/tests/conftest.py
index 0914557..c6532a1 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -25,11 +25,17 @@ def headless(request):
return request.param
+@pytest.fixture
+def project_root(request):
+ return request.config.getoption("--project-root")
+
+
# --headless is the default flag for most tests,
# but you can set --no-headless if you want to watch
def pytest_addoption(parser):
parser.addoption("--headless", action="store_true", dest="headless", default=True)
parser.addoption("--no-headless", dest="headless", action="store_false")
+ parser.addoption("--project-root", action="store", default=None, help="Project root directory")
# browser fixture will supply a browser for you
diff --git a/tests/test_version.py b/tests/test_version.py
new file mode 100644
index 0000000..81beb0f
--- /dev/null
+++ b/tests/test_version.py
@@ -0,0 +1,32 @@
+import importlib.metadata
+import re
+import pathlib
+
+import choreographer
+
+
+def test_version_matches_debian_package(project_root):
+ """
+ Test that choreographer version metadata matches the Debian package version.
+
+ This is a check that the maintainer remembered to update the version in debian/patches/pyproject-add-version.diff when releasing a new version.
+ The patch is needed becaue upstream depends on setuptools-git-versioning, which is not available in Debian.
+ """
+ # Get version from python
+ version_from_python = importlib.metadata.version("choreographer")
+
+ # Read debian/changelog and extract the version
+ if project_root is not None:
+ changelog_path = pathlib.Path(project_root) / "debian" / "changelog"
+ else:
+ changelog_path = pathlib.Path(__file__).parent.parent / "debian" / "changelog"
+ changelog_content = changelog_path.read_text()
+ match = re.search(r"python-choreographer \(([^)]+)\)", changelog_content)
+ assert match, "Could not find version in debian/changelog"
+ version_from_debian, _ = match.group(1).split("-")
+
+ # Compare the two versions
+ assert version_from_python == version_from_debian, (
+ f"Version in pyproject.toml ({version_from_python}) does not match "
+ f"Debian version ({version_from_debian}). Please update debian/patches/pyproject-add-version.diff to set the correct version."
+ )
|