You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* setup-python: Remove custom python-version output
* tests: Update test_setup_python to validate env.pythonVersion
* tests: Test both env.pythonVersion and outputs.python-version
match = re.search(r"(\d+)\.(\d+)(?:\.(\d+))?", matrix_python_version)
27
32
expected_version = tuple(int(g) for g in match.groups() if g is not None)
28
33
version = sys.version_info[:len(expected_version)]
29
34
if version != expected_version:
30
35
print(f"::error title=Test Failure::The Python version does not match. Got {version}, expected {expected_version}.")
31
36
sys.exit(1)
37
+
match = re.search(r"(\d+)\.(\d+)(?:\.(\d+))?", output_python_version)
38
+
output_version = tuple(int(g) for g in match.groups() if g is not None)[:len(expected_version)]
39
+
if output_version != expected_version:
40
+
print(f"::error title=Test Failure::The outputs.python-version version does not match. Got {output_version}, expected {expected_version}.")
41
+
sys.exit(1)
42
+
32
43
implementation = sys.implementation.name
33
-
expected_implementation = "pypy" if "${{ matrix.python-version }}".startswith("pypy") else "cpython"
44
+
expected_implementation = "pypy" if matrix_python_version.startswith("pypy") else "cpython"
34
45
if implementation != expected_implementation:
35
46
print(f"::error title=Test Failure::The Python implementation does not match. Got {implementation}, expected {expected_implementation}.")
36
47
sys.exit(1)
48
+
output_implementation = "pypy" if output_python_version.startswith("pypy") else "cpython"
49
+
if output_implementation != expected_implementation:
50
+
print(f"::error title=Test Failure::The outputs.python-version implementation does not match. Got {output_implementation}, expected {expected_implementation}.")
51
+
37
52
threading = "free-threading" if sysconfig.get_config_var("Py_GIL_DISABLED") else "GIL"
38
-
expected_threading = "free-threading" if "t" in "${{ matrix.python-version }}" else "GIL"
53
+
expected_threading = "free-threading" if "t" in matrix_python_version else "GIL"
39
54
if threading != expected_threading:
40
55
print(f"::error title=Test Failure::The Python threading does not match. Got {threading}, expected {expected_threading}.")
41
56
sys.exit(1)
57
+
output_threading = "free-threading" if "t" in output_python_version else "GIL"
58
+
if output_threading != expected_threading:
59
+
print(f"::error title=Test Failure::The outputs.python-version threading does not match. Got {output_threading}, expected {expected_threading}.")
60
+
61
+
env_python_version = os.environ["pythonVersion"]
62
+
if env_python_version != output_python_version:
63
+
print(f"::error title=Test Failure::env.pythonVersion does not match outputs.python-version. Got {env_python_version}, expected {output_python_version}.")
0 commit comments