diff --git a/CHANGELOG.md b/CHANGELOG.md index b94d2cc..d994beb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +v3.1.1 (in development) +----------------------- +- Correctly mark a certain test as requiring Mercurial + v3.1.0 (2024-03-16) ------------------- - When `git describe` fails to retrieve a tag, the resulting log/error message diff --git a/docs/changelog.rst b/docs/changelog.rst index e514537..9207ffc 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -3,6 +3,11 @@ Changelog ========= +v3.1.1 (in development) +----------------------- +- Correctly mark a certain test as requiring Mercurial + + v3.1.0 (2024-03-16) ------------------- - When :command:`git describe` fails to retrieve a tag, the resulting log/error diff --git a/src/versioningit/__init__.py b/src/versioningit/__init__.py index be694f1..5898d97 100644 --- a/src/versioningit/__init__.py +++ b/src/versioningit/__init__.py @@ -43,7 +43,7 @@ for more information. """ -__version__ = "3.1.0" +__version__ = "3.1.1.dev1" __author__ = "John Thorvald Wodder II" __author_email__ = "versioningit@varonathe.org" __license__ = "MIT" diff --git a/test/data/repos/errors/archive-no-tag.json b/test/data/repos/git-errors/archive-no-tag.json similarity index 100% rename from test/data/repos/errors/archive-no-tag.json rename to test/data/repos/git-errors/archive-no-tag.json diff --git a/test/data/repos/errors/archive-no-tag.marks b/test/data/repos/git-errors/archive-no-tag.marks similarity index 100% rename from test/data/repos/errors/archive-no-tag.marks rename to test/data/repos/git-errors/archive-no-tag.marks diff --git a/test/data/repos/errors/archive-no-tag.zip b/test/data/repos/git-errors/archive-no-tag.zip similarity index 100% rename from test/data/repos/errors/archive-no-tag.zip rename to test/data/repos/git-errors/archive-no-tag.zip diff --git a/test/data/repos/errors/hatch-no-tag.json b/test/data/repos/git-errors/hatch-no-tag.json similarity index 100% rename from test/data/repos/errors/hatch-no-tag.json rename to test/data/repos/git-errors/hatch-no-tag.json diff --git a/test/data/repos/errors/hatch-no-tag.marks b/test/data/repos/git-errors/hatch-no-tag.marks similarity index 100% rename from test/data/repos/errors/hatch-no-tag.marks rename to test/data/repos/git-errors/hatch-no-tag.marks diff --git a/test/data/repos/errors/hatch-no-tag.zip b/test/data/repos/git-errors/hatch-no-tag.zip similarity index 100% rename from test/data/repos/errors/hatch-no-tag.zip rename to test/data/repos/git-errors/hatch-no-tag.zip diff --git a/test/data/repos/errors/no-tag.json b/test/data/repos/git-errors/no-tag.json similarity index 100% rename from test/data/repos/errors/no-tag.json rename to test/data/repos/git-errors/no-tag.json diff --git a/test/data/repos/errors/no-tag.marks b/test/data/repos/git-errors/no-tag.marks similarity index 100% rename from test/data/repos/errors/no-tag.marks rename to test/data/repos/git-errors/no-tag.marks diff --git a/test/data/repos/errors/no-tag.zip b/test/data/repos/git-errors/no-tag.zip similarity index 100% rename from test/data/repos/errors/no-tag.zip rename to test/data/repos/git-errors/no-tag.zip diff --git a/test/data/repos/errors/template-fields-error.json b/test/data/repos/git-errors/template-fields-error.json similarity index 100% rename from test/data/repos/errors/template-fields-error.json rename to test/data/repos/git-errors/template-fields-error.json diff --git a/test/data/repos/errors/template-fields-error.zip b/test/data/repos/git-errors/template-fields-error.zip similarity index 100% rename from test/data/repos/errors/template-fields-error.zip rename to test/data/repos/git-errors/template-fields-error.zip diff --git a/test/data/repos/errors/hg-no-tag.json b/test/data/repos/hg-errors/hg-no-tag.json similarity index 100% rename from test/data/repos/errors/hg-no-tag.json rename to test/data/repos/hg-errors/hg-no-tag.json diff --git a/test/data/repos/errors/hg-no-tag.zip b/test/data/repos/hg-errors/hg-no-tag.zip similarity index 100% rename from test/data/repos/errors/hg-no-tag.zip rename to test/data/repos/hg-errors/hg-no-tag.zip diff --git a/test/test_end2end.py b/test/test_end2end.py index c021741..f2690a3 100644 --- a/test/test_end2end.py +++ b/test/test_end2end.py @@ -240,9 +240,32 @@ def test_get_version_config_only( @pytest.mark.parametrize( - "repozip,details", mkcases("errors", [needs_git], details_cls=ErrorDetails) + "repozip,details", mkcases("git-errors", [needs_git], details_cls=ErrorDetails) ) -def test_end2end_error(tmp_path: Path, repozip: Path, details: ErrorDetails) -> None: +def test_end2end_git_error( + tmp_path: Path, repozip: Path, details: ErrorDetails +) -> None: + shutil.unpack_archive(repozip, tmp_path) + with pytest.raises(Error) as excinfo: + get_version(project_dir=tmp_path, write=False, fallback=True) + assert type(excinfo.value).__name__ == details.type + assert str(excinfo.value) == details.message + r = subprocess.run( + [sys.executable, "-m", "build", "--no-isolation", str(tmp_path)], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + ) + assert r.returncode != 0 + out = r.stdout + assert isinstance(out, str) + assert details.message in out + + +@pytest.mark.parametrize( + "repozip,details", mkcases("hg-errors", [needs_hg], details_cls=ErrorDetails) +) +def test_end2end_hg_error(tmp_path: Path, repozip: Path, details: ErrorDetails) -> None: shutil.unpack_archive(repozip, tmp_path) with pytest.raises(Error) as excinfo: get_version(project_dir=tmp_path, write=False, fallback=True)