def test_invalid_part(): with conftest.capture_output() as logged: versioning = dict(foo="bar", main="{foo}.{major}.{minor}{", extra=extra_version, separator="-") meta = new_meta(versioning, scm=conftest.MockGit()) versioning = meta.versioning assert "invalid" in str(versioning.strategy.main_bits) assert meta.version is None assert versioning.problem == "invalid versioning part 'foo'" assert str( versioning.strategy ) == "branch(master):{foo}.{major}.{minor}{-function 'extra_version'" check_render(versioning, "invalid.1.0") check_render(versioning, "invalid.1.0-d2", distance=2) check_render(versioning, "invalid.1.0-extra", distance=2, dirty=True) assert "Ignored fields for 'versioning': {'foo': 'bar'}" in logged with pytest.raises(setupmeta.UsageError): versioning.bump("minor") with pytest.raises(setupmeta.UsageError): versioning.get_bump("minor")
def check_get_bump(versioning): assert versioning.get_bump("major") == "1.0.0" assert versioning.get_bump("minor") == "0.2.0" with pytest.raises(setupmeta.UsageError): versioning.get_bump("foo")