def test_invalid_options(): """ Ensure we raise an error if given unknown options """ # Bad example with pytest.raises(VinnieConfigError): Vinnie(repo=".", cat_fart=True) # Good example Vinnie(repo=".", semver=False)
def test_invalid_url(): with pytest.raises(VinnieConfigError): v = Vinnie(repo_url="g[]") v.config.validate_repo_url() with pytest.raises(VinnieConfigError): v = Vinnie(repo_url="github.com") v.config.validate_repo_url() v = Vinnie(repo_url="https://github.com/", github_token="XXXX") v.config.validate_repo_url()
def test_validate_repo_path(repo): dne = repo_path("paths/does-not-exist") not_dir = repo_path("paths/not-a-dir") a_dir = repo_path("paths/a-dir") # Directory has to exist with pytest.raises(VinnieConfigError): Vinnie(repo=dne) # Has to be a directory with pytest.raises(VinnieConfigError): Vinnie(repo=not_dir) # Has to look like a repo with pytest.raises(VinnieConfigError): Vinnie(repo=a_dir) Vinnie(repo=repo)
def test_version_mixed2(mixed_repo2): v = Vinnie(repo=mixed_repo2, prefix="v") assert v.version() == "v0.0.1"
def test_version_mixed(mixed_repo): v = Vinnie(repo=mixed_repo, prefix="v") assert v.version() == "v0.0.2"
def test_major(repo): v = Vinnie(repo=repo, prefix="v") assert v.version() == "v0.0.2" assert v.next_major() == "v1.0.0" assert v.version() == "v1.0.0"
def test_patch(repo): v = Vinnie(repo=repo, prefix="v") assert v.version() == "v0.0.2" assert v.next_patch() == "v0.0.3" assert v.version() == "v0.0.3"
def test_bump(non_semver_repo): v = Vinnie(repo=non_semver_repo, prefix="v") assert v.version() == "v2" assert v.next_bump() == "v3"
def test_next_minor(repo): v = Vinnie(repo=repo, prefix="v") assert v.version() == "v0.0.2" assert v.get_next_minor() == "v0.1.0"
def test_resetup(repo): v = Vinnie(repo=repo) assert v.setup_backend() is None
def test_repo_without_tags_no_semver(empty_repo): """ This tests situations where there are no initial tags """ v = Vinnie(repo=empty_repo, semver=False) v.dump() assert v.version() == "0" assert v.get_next_bump() == "1"
def test_repo_without_tags(empty_repo): """ This tests situations where there are no initial tags """ v = Vinnie(repo=empty_repo) v.dump() assert v.version() == "0.0.0" assert v.get_next_patch() == "0.0.1"
def test_current_version(repo): # When given a version, use that instead of whatever is found in the repo v = Vinnie(repo=repo, current_version="2.1.1") assert v.version() == "2.1.1" assert v.get_next_patch() == "2.1.2"
def test_version(repo): v = Vinnie(repo=repo, prefix="v") assert v.version() == "v0.0.2"
def test_url_and_path(repo): with pytest.raises(VinnieConfigError): Vinnie(repo=repo, repo_url="https://github/")