Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional normalization of requirements #132

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test requirements.txt name normalization
  • Loading branch information
sbidoul committed Jan 5, 2024
commit bcc2405f7a59ad9cbab64f9a55e936f216fc97ae
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ def testpkgs(tmp_path_factory):
extras_require={"c": ["pkgc<0.0.3"], "b": ["pkgb"]},
),
dict(name="pkge", install_requires=["pkgd[b,c]"]),
dict(name="pkg-F.G_H"), # to test name normalization
]

testpkgs_dir = tmp_path_factory.mktemp("testpkgs")
33 changes: 33 additions & 0 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
@@ -47,6 +47,39 @@ def test_sync(virtualenv_python, testpkgs, tmp_path):
)


def test_sync_normalization(virtualenv_python, testpkgs, tmp_path):
(tmp_path / "requirements.txt.in").write_text(
textwrap.dedent(
f"""\
--no-index
--find-links {testpkgs}
"""
)
)
(tmp_path / "pyproject.toml").write_text(
textwrap.dedent(
"""\
[project]
name = "theproject"
version = "1.0"
dependencies = ["pkg-F.G_H"]
"""
)
)
subprocess.check_call(
[sys.executable, "-m", "pip_deepfreeze", "--python", virtualenv_python, "sync"],
cwd=tmp_path,
)
assert (tmp_path / "requirements.txt").read_text() == textwrap.dedent(
f"""\
# frozen requirements generated by pip-deepfreeze
--no-index
--find-links {testpkgs}
pkg-f-g-h==0.0.0
"""
)


def test_sync_no_in_req(virtualenv_python, tmp_path):
(tmp_path / "setup.py").write_text(
textwrap.dedent(