diff --git a/test/test_util.py b/test/test_util.py index 0111ffb32..3fb0208f3 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -562,3 +562,14 @@ def test_construct_pip_call(declaration, expected_result): ]) def test_replace_cpython_version(arg, new_version, expected): assert util.replace_cpython_version(arg, new_version) == expected + + +@pytest.mark.parametrize("path, expected_version", [ + ("/home/jdoe/micromamba/envs/asv_exp/bin/python3.11", "3.11"), + ("/usr/local/bin/python3.12", "3.12"), + ("/opt/anaconda3/bin/python3.9", "3.9"), + ("/usr/bin/python", None), + ("/home/user/custom_python/python_alpha", None), +]) +def test_extract_python_version(path, expected_version): + assert util.extract_cpython_version(path) == expected_version diff --git a/test/test_workflow.py b/test/test_workflow.py index a55e0f173..f7b1e0d7e 100644 --- a/test/test_workflow.py +++ b/test/test_workflow.py @@ -72,7 +72,7 @@ def basic_conf(tmpdir, dummy_packages): @pytest.mark.skipif(tools.HAS_PYPY or (os.name == 'nt'), reason="Flaky on pypy and windows") -def test_run_publish(capfd, basic_conf): +def test_run_publish(capfd, basic_conf, request: pytest.FixtureRequest): tmpdir, local, conf, machine_file = basic_conf tmpdir = util.long_path(tmpdir)