diff options
author | Pradyun Gedam <3275593+pradyunsg@users.noreply.github.com> | 2020-08-18 19:25:07 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-18 19:25:07 +0530 |
commit | e1d489fce65fc7d908b5807b2e58c0c073237fec (patch) | |
tree | e35b63fd2c9d1a5b1355db78cbe3d23efeff9cd4 | |
parent | ae7ed9a650bee9506d451b54abc60ba0b599a6a7 (diff) | |
parent | 14397418d178bdc20c8084d39c1219d08425dbd3 (diff) | |
download | pip-e1d489fce65fc7d908b5807b2e58c0c073237fec.tar.gz |
Merge pull request #8743 from McSinyx/fast-deps-hash
Test hash checking for fast-deps
-rw-r--r-- | news/0e494986-202e-4275-b7ec-d6f046c0aa05.trivial | 0 | ||||
-rw-r--r-- | tests/functional/test_fast_deps.py | 29 |
2 files changed, 29 insertions, 0 deletions
diff --git a/news/0e494986-202e-4275-b7ec-d6f046c0aa05.trivial b/news/0e494986-202e-4275-b7ec-d6f046c0aa05.trivial new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/news/0e494986-202e-4275-b7ec-d6f046c0aa05.trivial diff --git a/tests/functional/test_fast_deps.py b/tests/functional/test_fast_deps.py index b41055c56..655440b88 100644 --- a/tests/functional/test_fast_deps.py +++ b/tests/functional/test_fast_deps.py @@ -48,3 +48,32 @@ def test_build_wheel_with_deps(data, script): assert fnmatch.filter(created, 'requiresPaste-3.1.4-*.whl') assert fnmatch.filter(created, 'Paste-3.4.2-*.whl') assert fnmatch.filter(created, 'six-*.whl') + + +@mark.network +def test_require_hash(script, tmp_path): + reqs = tmp_path / 'requirements.txt' + reqs.write_text( + u'idna==2.10' + ' --hash=sha256:' + 'b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0' + ' --hash=sha256:' + 'b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6' + ) + result = script.pip( + 'download', '--use-feature=fast-deps', '-r', str(reqs), + allow_stderr_warning=True, + ) + created = list(map(basename, result.files_created)) + assert fnmatch.filter(created, 'idna-2.10*') + + +@mark.network +def test_hash_mismatch(script, tmp_path): + reqs = tmp_path / 'requirements.txt' + reqs.write_text(u'idna==2.10 --hash=sha256:irna') + result = script.pip( + 'download', '--use-feature=fast-deps', '-r', str(reqs), + expect_error=True, + ) + assert 'DO NOT MATCH THE HASHES' in result.stderr |