Skip to content

Commit 193c9df

Browse files
JayBazuzisusanfungtrilliumreyr-devisidore
committed
. t build all wheels before testing so approvaltests uses the local approval_utilities
Co-Authored-By: Susan Fung <38925660+susanfung@users.noreply.github.com> Co-Authored-By: Trillium Smith <trillium@trilliumsmith.com> Co-Authored-By: reyr-dev <236299828+reyr-dev@users.noreply.github.com> Co-Authored-By: Llewellyn Falco <llewellyn.falco@gmail.com> Co-Authored-By: Joss Hufnagel <43077216+blade290@users.noreply.github.com>
1 parent 8177268 commit 193c9df

1 file changed

Lines changed: 23 additions & 13 deletions

File tree

test__mypy_accepts_our_packages.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@
55
import tempfile
66
import time
77

8+
PACKAGES = [
9+
("approval_utilities", "setup.approval_utilities.py"),
10+
("approvaltests", "setup.approvaltests.py"),
11+
("approvaltests", "setup.approvaltests-minimal.py"),
12+
]
13+
814

915
def main() -> None:
10-
for package_name, setup_file in [
11-
("approval_utilities", "setup.approval_utilities.py"),
12-
("approvaltests", "setup.approvaltests.py"),
13-
("approvaltests", "setup.approvaltests-minimal.py"),
14-
]:
15-
dist_dir = pathlib.Path("dist")
16-
if dist_dir.exists():
17-
shutil.rmtree(dist_dir)
16+
dist_dir = pathlib.Path("dist")
17+
if dist_dir.exists():
18+
shutil.rmtree(dist_dir)
19+
20+
built: list[tuple[str, pathlib.Path]] = []
21+
for package_name, setup_file in PACKAGES:
22+
before = set(dist_dir.glob("*.whl")) if dist_dir.exists() else set()
1823

1924
shutil.copy2("setup/" + setup_file, "setup.py")
2025
try:
@@ -24,24 +29,29 @@ def main() -> None:
2429
finally:
2530
_unlink_with_retry(pathlib.Path("setup.py"))
2631

32+
after = set(dist_dir.glob("*.whl"))
33+
new_wheels = after - before
34+
assert len(new_wheels) == 1, f"Expected 1 new wheel, found {new_wheels}"
35+
built.append((package_name, new_wheels.pop().resolve()))
36+
37+
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
38+
39+
for package_name, wheel_file in built:
2740
with tempfile.TemporaryDirectory() as _temporary_directory:
2841
temporary_directory = pathlib.Path(_temporary_directory)
2942

30-
wheel_files = list(dist_dir.glob("*.whl"))
31-
assert len(wheel_files) == 1, f"Expected 1 wheel, found {wheel_files}"
32-
wheel_file = wheel_files[0].resolve()
33-
3443
test_file_path = temporary_directory / "test.py"
3544
test_file_path.write_text(f"import {package_name}")
3645

37-
python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
3846
subprocess.check_call(
3947
[
4048
"uv",
4149
"run",
4250
"--isolated",
4351
"--python",
4452
python_version,
53+
"--find-links",
54+
str(dist_dir.resolve()),
4555
"--with",
4656
wheel_file,
4757
"--with",

0 commit comments

Comments
 (0)