Skip to content

Commit 1e39fa7

Browse files
committed
fix(tests): fix failing e2e regression tests for release
1 parent 23c1e1f commit 1e39fa7

4 files changed

Lines changed: 29 additions & 4 deletions

File tree

.detect-secrets.scan.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,5 @@
139139
}
140140
]
141141
},
142-
"generated_at": "2026-06-11T21:44:25Z"
142+
"generated_at": "2026-06-12T09:44:07Z"
143143
}

src/gitversioned/compat.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import types
1515
from typing import Annotated
1616

17-
__all__ = ["maturin", "opentelemetry_trace", "psutil", "tomllib"]
17+
__all__ = ["DistutilsSetupError", "maturin", "opentelemetry_trace", "psutil", "tomllib"]
1818

1919
_maturin: types.ModuleType | None = None
2020
try:
@@ -45,6 +45,19 @@
4545
except ImportError:
4646
_psutil = None
4747

48+
_DistutilsSetupError: type[Exception]
49+
try:
50+
import setuptools.errors
51+
52+
_DistutilsSetupError = setuptools.errors.SetupError
53+
except ImportError:
54+
try:
55+
import distutils.errors
56+
57+
_DistutilsSetupError = distutils.errors.DistutilsSetupError
58+
except ImportError:
59+
_DistutilsSetupError = Exception
60+
4861
maturin: Annotated[
4962
types.ModuleType | None,
5063
"Enables the maturin build backend wrapper. Provides the ``maturin`` "
@@ -70,3 +83,8 @@
7083
"``pyproject.toml``. Provides the standard library ``tomllib``, the "
7184
"third-party ``tomli``, or ``None``.",
7285
] = _tomllib
86+
87+
DistutilsSetupError: Annotated[
88+
type[Exception],
89+
"The SetupError exception class resolved from setuptools or distutils.",
90+
] = _DistutilsSetupError

src/gitversioned/plugins/setuptools_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
import email
2020
import os
21-
from distutils.errors import DistutilsSetupError
2221
from pathlib import Path
2322
from typing import Any, cast
2423

2524
from packaging.utils import canonicalize_name
2625
from setuptools import Distribution
2726

27+
from gitversioned.compat import DistutilsSetupError
2828
from gitversioned.logging import autolog, configure_logger, logger
2929
from gitversioned.settings import Settings
3030
from gitversioned.utils import BuildEnvironment, GitRepository

tests/python/unit/test_compat.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ def restore_compat_module() -> Any:
4343
@pytest.mark.smoke
4444
def test_smoke_module_exports() -> None:
4545
"""Verify that compat exposes the expected variables and matches expected types."""
46-
assert compat.__all__ == ["maturin", "opentelemetry_trace", "psutil", "tomllib"]
46+
assert compat.__all__ == [
47+
"DistutilsSetupError",
48+
"maturin",
49+
"opentelemetry_trace",
50+
"psutil",
51+
"tomllib",
52+
]
53+
assert hasattr(compat, "DistutilsSetupError")
4754
assert hasattr(compat, "maturin")
4855
assert hasattr(compat, "opentelemetry_trace")
4956
assert hasattr(compat, "psutil")

0 commit comments

Comments
 (0)