def test_add_package_force(): pkg1 = Package('test-0.0.1', ['foo']) pkg2 = Package('test-0.0.1', ['bar']) index = Index([pkg1]) index.add_package(pkg2, force=True) assert index.packages == {pkg2}
def test_add_package(): pkg1 = Package('test-0.0.1', ['foo']) pkg2 = Package('test-0.0.2', ['bar']) index = Index([pkg1]) index.add_package(pkg2) assert index.packages == {pkg1, pkg2}
def test_add_package_exists(): pkg1 = Package('test-0.0.1', ['foo']) pkg2 = Package('test-0.0.1', ['bar']) index = Index([pkg1]) with pytest.raises(S3PyPiError): index.add_package(pkg2)
def test_add_package_exists(): pkg1 = Package("test-0.0.1", ["foo"]) pkg2 = Package("test-0.0.1", ["bar"]) index = Index([pkg1]) with pytest.raises(S3PyPiError): index.add_package(pkg2)
def test_add_package_force(): pkg1 = Package("test-0.0.1", ["foo"]) pkg2 = Package("test-0.0.1", ["bar"]) index = Index([pkg1]) index.add_package(pkg2, force=True) assert index.packages == {pkg2}
def test_add_package(): pkg1 = Package("test-0.0.1", ["foo"]) pkg2 = Package("test-0.0.2", ["bar"]) index = Index([pkg1]) index.add_package(pkg2) assert index.packages == {pkg1, pkg2}
def test_add_package_force(): pkg1 = Package("test-0.0.1", ["foo"]) pkg2 = Package("test-0.0.1", ["bar"]) index = Index([pkg1]) index.add_package(pkg2, force=True) assert len(index.packages) == 1 assert next(iter(index.packages)).files == {"foo", "bar"}