Skip to content

Commit

Permalink
Fix test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Jun 17, 2024
1 parent 978a9a1 commit 33e68b4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,22 @@ def test_pep621_with_dynamic_version():

run("poetry-dynamic-versioning", where=dummy)
assert f'version = "{version}"' in dummy_pyproject.read_bytes().decode("utf-8")
assert f'__version__ = "{version}"' in (dummy / "project" / "__init__.py").read_bytes().decode(
"utf-8"
)
assert f'__version__ = "{version}"' in (
dummy / "project_pep621" / "__init__.py"
).read_bytes().decode("utf-8")


@pytest.mark.skipif("USE_PEP621" not in os.environ, reason="Requires Poetry with PEP-621 support")
def test_pep621_without_dynamic_version():
dummy = ROOT / "tests" / "project-pep621"
dummy_pyproject = dummy / "pyproject.toml"

data = dummy_pyproject.read_bytes().decode("utf-8")
data = re.sub(r"dynamic = .*", "dynamic = []", data)
dummy_pyproject.write_bytes(data.encode("utf-8"))

run("poetry-dynamic-versioning", where=dummy)
assert "version =" not in dummy_pyproject.read_bytes().decode("utf-8")
assert '__version__ = "0.0.0"' in (dummy / "project" / "__init__.py").read_bytes().decode(
"utf-8"
)
assert '__version__ = "0.0.0"' in (
dummy / "project_pep621" / "__init__.py"
).read_bytes().decode("utf-8")

0 comments on commit 33e68b4

Please sign in to comment.