Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pipper_main(mocker, capsys, make_dist, tmp_path):
make_dist(name="fakedist", version="1.2.3")
mocker.patch("sys.argv", "pipper.py fakedist".split())
with working_directory(tmp_path):
johnnydep.pipper.main()
out, err = capsys.readouterr()
output = json.loads(out)
path = output.pop("path")
checksum = output.pop("checksum")
assert output == {"url": "http://fakeindex/fakedist-1.2.3-py2.py3-none-any.whl"}
assert os.path.isfile(path)
assert os.path.basename(path) == "fakedist-1.2.3-py2.py3-none-any.whl"
assert len(checksum) == 4 + 32
assert checksum.startswith("md5=")
assert err == ""