Skip to content

Commit

Permalink
test(migrations): add test for new PEP 440 environment variables in m…
Browse files Browse the repository at this point in the history
…igrations

In 745a490 I added this new feature, but did not add a test for it.
  • Loading branch information
yajo committed Nov 2, 2021
1 parent 2a059d2 commit 080e3f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/demo_migrations/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import os
import sys

NAME = "{VERSION_FROM}-{VERSION_CURRENT}-{VERSION_TO}-{STAGE}.json"
NAMES = (
"{VERSION_FROM}-{VERSION_CURRENT}-{VERSION_TO}-{STAGE}.json",
"PEP440-{VERSION_PEP440_FROM}-{VERSION_PEP440_CURRENT}-{VERSION_PEP440_TO}-{STAGE}.json",
)

with open(NAME.format(**os.environ), "w") as fd:
json.dump(sys.argv, fd)
for name in NAMES:
with open(name.format(**os.environ), "w") as fd:
json.dump(sys.argv, fd)
2 changes: 2 additions & 0 deletions tests/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def test_migrations_and_tasks(tmp_path: Path):
assert not (dst / "tasks.py").exists()
assert (dst / "v1.0.0-v2-v2.0-before.json").is_file()
assert (dst / "v1.0.0-v2-v2.0-after.json").is_file()
assert (dst / "PEP440-1.0.0-2-2.0-before.json").is_file()
assert (dst / "PEP440-1.0.0-2-2.0-after.json").is_file()
answers = yaml.safe_load((dst / ".copier-answers.yml").read_text())
assert answers == {"_commit": "v2.0", "_src_path": str(git_src)}

Expand Down

0 comments on commit 080e3f6

Please sign in to comment.