def test_sync_clean_packages(project, working_set): for candidate in [ Distribution("foo", "0.1.0"), Distribution("chardet", "3.0.1"), Distribution("idna", "2.7"), ]: working_set.add_distribution(candidate) actions.do_add(project, packages=["requests"], sync=False) actions.do_sync(project, clean=True) assert "foo" not in working_set
def test_sync_only_different(project, working_set, capsys): working_set.add_distribution(Distribution("foo", "0.1.0")) working_set.add_distribution(Distribution("chardet", "3.0.1")) working_set.add_distribution(Distribution("idna", "2.7")) actions.do_add(project, packages=["requests"]) out, _ = capsys.readouterr() assert "3 to add" in out assert "1 to update" in out assert "foo" in working_set assert "test-project" in working_set assert working_set["chardet"].version == "3.0.4"
def make_distribution(name, version): req = Requirement(name) return Distribution(req.key, version)