Skip to content

Commit

Permalink
Merge pull request #84 from jwodder/mark-hg-error
Browse files Browse the repository at this point in the history
Correctly mark a certain test as requiring Mercurial
  • Loading branch information
jwodder committed Apr 9, 2024
2 parents 8903e8f + 37e7d07 commit 48c2c93
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/versioningit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<https://versioningit.rtfd.io> for more information.
"""

__version__ = "3.1.0"
__version__ = "3.1.1.dev1"
__author__ = "John Thorvald Wodder II"
__author_email__ = "versioningit@varonathe.org"
__license__ = "MIT"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 25 additions & 2 deletions test/test_end2end.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 48c2c93

Please sign in to comment.