| 17 | |
| 18 | |
| 19 | class MirrorIntegrationTests(unittest.TestCase): |
| 20 | def test_uploads_artifacts_to_mock_s3(self) -> None: |
| 21 | with tempfile.TemporaryDirectory() as td: |
| 22 | dist = Path(td) / "dist" |
| 23 | dist.mkdir() |
| 24 | |
| 25 | full_path = ( |
| 26 | dist |
| 27 | / "cpython-3.12.10-x86_64-unknown-linux-gnu-pgo+lto-20260324T1200.tar.zst" |
| 28 | ) |
| 29 | install_only_path = ( |
| 30 | dist |
| 31 | / "cpython-3.12.10-x86_64-unknown-linux-gnu-install_only-20260324T1200.tar.gz" |
| 32 | ) |
| 33 | shasums_path = dist / "SHA256SUMS" |
| 34 | |
| 35 | full_path.write_bytes(b"full") |
| 36 | install_only_path.write_bytes(b"install") |
| 37 | shasums_path.write_text( |
| 38 | "abc cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst\n" |
| 39 | "def cpython-3.12.10+20260324-x86_64-unknown-linux-gnu-install_only.tar.gz\n" |
| 40 | ) |
| 41 | |
| 42 | server = ThreadedMotoServer(ip_address="127.0.0.1", port=0, verbose=False) |
| 43 | server.start() |
| 44 | try: |
| 45 | host, port = server.get_host_and_port() |
| 46 | endpoint_url = f"http://{host}:{port}" |
| 47 | bucket = "mirror-bucket" |
| 48 | prefix = "github/python-build-standalone/releases/download/20260324/" |
| 49 | |
| 50 | s3 = boto3.client( |
| 51 | "s3", |
| 52 | endpoint_url=endpoint_url, |
| 53 | region_name="us-east-1", |
| 54 | aws_access_key_id="testing", |
| 55 | aws_secret_access_key="testing", |
| 56 | ) |
| 57 | s3.create_bucket(Bucket=bucket) |
| 58 | |
| 59 | with mock.patch.dict( |
| 60 | os.environ, |
| 61 | { |
| 62 | "AWS_ACCESS_KEY_ID": "testing", |
| 63 | "AWS_SECRET_ACCESS_KEY": "testing", |
| 64 | "AWS_DEFAULT_REGION": "us-east-1", |
| 65 | "AWS_ENDPOINT_URL": endpoint_url, |
| 66 | }, |
| 67 | ): |
| 68 | self.assertEqual( |
| 69 | main( |
| 70 | [ |
| 71 | "--dist", |
| 72 | str(dist), |
| 73 | "--tag", |
| 74 | "20260324", |
| 75 | "--bucket", |
| 76 | bucket, |
nothing calls this directly
no outgoing calls
no test coverage detected