MCPcopy Create free account
hub / github.com/astral-sh/python-build-standalone / MirrorTests

Class MirrorTests

tests/test_mirror.py:24–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23
24class MirrorTests(unittest.TestCase):
25 def test_destination_to_source_name_full_archive(self) -> None:
26 self.assertEqual(
27 destination_to_source_name(
28 "cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst",
29 "20260324",
30 "20260324T1200",
31 ),
32 "cpython-3.12.10-x86_64-unknown-linux-gnu-pgo+lto-20260324T1200.tar.zst",
33 )
34
35 def test_destination_to_source_name_install_only_archive(self) -> None:
36 self.assertEqual(
37 destination_to_source_name(
38 "cpython-3.13.2+20260324-x86_64-unknown-linux-gnu-freethreaded-install_only.tar.gz",
39 "20260324",
40 "20260324T1200",
41 ),
42 "cpython-3.13.2-x86_64-unknown-linux-gnu-freethreaded-install_only-20260324T1200.tar.gz",
43 )
44
45 def test_destination_to_source_name_rejects_wrong_tag(self) -> None:
46 with self.assertRaises(MirrorError):
47 destination_to_source_name(
48 "cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst",
49 "20260325",
50 "20260324T1200",
51 )
52
53 def test_build_upload_entries(self) -> None:
54 with tempfile.TemporaryDirectory() as td:
55 dist = Path(td)
56 (
57 dist
58 / "cpython-3.12.10-x86_64-unknown-linux-gnu-pgo+lto-20260324T1200.tar.zst"
59 ).write_bytes(b"full")
60 (
61 dist
62 / "cpython-3.12.10-x86_64-unknown-linux-gnu-install_only-20260324T1200.tar.gz"
63 ).write_bytes(b"install")
64 (dist / "SHA256SUMS").write_text(
65 "abc cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst\n"
66 "def cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-install_only.tar.gz\n"
67 )
68
69 uploads, missing = build_upload_entries(dist, "20260324")
70
71 self.assertEqual(missing, [])
72 self.assertEqual(
73 uploads,
74 [
75 UploadEntry(
76 source_name="cpython-3.12.10-x86_64-unknown-linux-gnu-pgo+lto-20260324T1200.tar.zst",
77 dest_name="cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst",
78 ),
79 UploadEntry(
80 source_name="cpython-3.12.10-x86_64-unknown-linux-gnu-install_only-20260324T1200.tar.gz",
81 dest_name="cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-install_only.tar.gz",

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected