From 025341e3fc28e73e64a3d73ad4b6d4b11b3e5f07 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 28 Jan 2024 12:02:17 +0000 Subject: [PATCH 01/15] BUG: Respect env mambarc in the mamba plugin --- asv/plugins/mamba.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/asv/plugins/mamba.py b/asv/plugins/mamba.py index f095a56fe..2e0badc99 100644 --- a/asv/plugins/mamba.py +++ b/asv/plugins/mamba.py @@ -4,6 +4,7 @@ import re from pathlib import Path +import yaml from yaml import load try: @@ -54,7 +55,7 @@ def __init__(self, conf, python, requirements, tagged_env_vars): self._requirements = requirements self._mamba_channels = conf.conda_channels self._mamba_environment_file = None - if "conda-forge" not in conf.conda_channels: + if "conda-forge" not in conf.conda_channels and not os.getenv("MAMBARC"): self._mamba_channels += ["conda-forge"] if conf.conda_environment_file == "IGNORE": @@ -74,6 +75,30 @@ def __init__(self, conf, python, requirements, tagged_env_vars): super(Mamba, self).__init__(conf, python, requirements, tagged_env_vars) self.context = libmambapy.Context() self.context.target_prefix = self._path + # Handle MAMBARC environment variable + mambarc_path = Path(os.getenv("MAMBARC", "")) + if mambarc_path.is_file(): + with mambarc_path.open() as f: + condarc_data = yaml.safe_load(f) + self._apply_condarc_settings(condarc_data) + + def _apply_condarc_settings(self, condarc_data): + # Apply channel settings + if 'channels' in condarc_data: + self.context.channels = condarc_data['channels'] + + # Apply channel priority settings + channel_priority_map = { + 'strict': libmambapy.ChannelPriority.kStrict, + 'flexible': libmambapy.ChannelPriority.kFlexible, + 'disabled': libmambapy.ChannelPriority.kDisabled + } + if 'channel_priority' in condarc_data: + priority_str = condarc_data['channel_priority'] + if priority_str in channel_priority_map: + self.context.channel_priority = channel_priority_map[priority_str] + else: + log.debug(f"Unknown channel priority: {priority_str}") @classmethod def matches(cls, python): From bcb7749cb8a12f87a8cca31cd34c9891ca19d3cd Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 28 Jan 2024 14:25:49 +0000 Subject: [PATCH 02/15] BUG: Ensure matrix dep resolution [mamba] --- CHANGES.rst | 1 + asv/plugins/mamba.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 30b632cbc..be8a75a52 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,7 @@ API Changes Bug Fixes ^^^^^^^^^ - The ``mamba`` plugin works correctly for newer versions (>=1.5) of ``libmambapy`` (#1372) +- Fixed a bug where ``matrix`` requirements were dropped if an environment file was specified. (#1373) Other Changes and Additions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/asv/plugins/mamba.py b/asv/plugins/mamba.py index 2e0badc99..bb3a4f808 100644 --- a/asv/plugins/mamba.py +++ b/asv/plugins/mamba.py @@ -132,7 +132,7 @@ def _setup(self): Path(f"{self._path}/conda-meta").mkdir(parents=True, exist_ok=True) if not self._mamba_environment_file: # Construct payload, env file sets python version - mamba_pkgs = [f"python={self._python}", "wheel", "pip"] + mamba_args + mamba_pkgs = [f"python={self._python}", "wheel", "pip"] else: # For named environments env_file_name = self._mamba_environment_file @@ -147,6 +147,7 @@ def _setup(self): pip_args += pip_maybe[0]["pip"] except KeyError: raise KeyError("Only pip is supported as a secondary key") + mamba_pkgs += mamba_args solver = MambaSolver( self._mamba_channels, None, self.context # or target_platform ) From d6ab7561a318544fbdd9bf38254c5e775458057a Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 28 Jan 2024 14:27:31 +0000 Subject: [PATCH 03/15] DOC: Document changes for mambarc --- CHANGES.rst | 2 ++ docs/source/asv.conf.json.rst | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index be8a75a52..1a788e355 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,8 @@ API Changes Bug Fixes ^^^^^^^^^ - The ``mamba`` plugin works correctly for newer versions (>=1.5) of ``libmambapy`` (#1372) +- The ``mamba`` plugin respects the ``MAMBARC`` environment if set, taking + channels and channel priority from the file in the environment variable. (#1373) - Fixed a bug where ``matrix`` requirements were dropped if an environment file was specified. (#1373) Other Changes and Additions diff --git a/docs/source/asv.conf.json.rst b/docs/source/asv.conf.json.rst index 55d306799..6b27abdc4 100644 --- a/docs/source/asv.conf.json.rst +++ b/docs/source/asv.conf.json.rst @@ -280,6 +280,14 @@ the project being benchmarked may specify in its ``setup.py`` file. These specifications in ``environment.yml`` or another (user-defined) file will be overridden by the environment matrix. + .. versionadded::0.6.2 + + The ``mamba`` plugin will now take channels and channel priority from the + ``MAMBARC`` environment variable if it is provided. e.g. + ``MAMBARC=$HOME/.condarc asv run``. By default user ``.rc`` files are not + read to enforce isolation. The ``conda-forge`` channel is used as a + default only if neither an environment file nor the ``MAMBARC`` variable + is set. The ``env`` and ``env_nobuild`` dictionaries can be used to set also environment variables:: From 007487ad4240c81d5d244f8dfbcc66041116c012 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 28 Jan 2024 14:31:48 +0000 Subject: [PATCH 04/15] MAINT: Do not pre-suppose conda-forge [mamba] --- CHANGES.rst | 1 + asv/plugins/mamba.py | 2 -- docs/source/asv.conf.json.rst | 4 +--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1a788e355..24e0e1a2b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,7 @@ Bug Fixes - The ``mamba`` plugin works correctly for newer versions (>=1.5) of ``libmambapy`` (#1372) - The ``mamba`` plugin respects the ``MAMBARC`` environment if set, taking channels and channel priority from the file in the environment variable. (#1373) +- ``conda-forge`` is no longer a default channel for ``mamba``. (#1373) - Fixed a bug where ``matrix`` requirements were dropped if an environment file was specified. (#1373) Other Changes and Additions diff --git a/asv/plugins/mamba.py b/asv/plugins/mamba.py index bb3a4f808..ecbaa0b12 100644 --- a/asv/plugins/mamba.py +++ b/asv/plugins/mamba.py @@ -55,8 +55,6 @@ def __init__(self, conf, python, requirements, tagged_env_vars): self._requirements = requirements self._mamba_channels = conf.conda_channels self._mamba_environment_file = None - if "conda-forge" not in conf.conda_channels and not os.getenv("MAMBARC"): - self._mamba_channels += ["conda-forge"] if conf.conda_environment_file == "IGNORE": log.debug("Skipping environment file due to conda_environment_file set to IGNORE") diff --git a/docs/source/asv.conf.json.rst b/docs/source/asv.conf.json.rst index 6b27abdc4..c7dc60da2 100644 --- a/docs/source/asv.conf.json.rst +++ b/docs/source/asv.conf.json.rst @@ -285,9 +285,7 @@ the project being benchmarked may specify in its ``setup.py`` file. The ``mamba`` plugin will now take channels and channel priority from the ``MAMBARC`` environment variable if it is provided. e.g. ``MAMBARC=$HOME/.condarc asv run``. By default user ``.rc`` files are not - read to enforce isolation. The ``conda-forge`` channel is used as a - default only if neither an environment file nor the ``MAMBARC`` variable - is set. + read to enforce isolation. The ``env`` and ``env_nobuild`` dictionaries can be used to set also environment variables:: From 8a0f950965e7c3bbcb723aa99110e8834fc131e1 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 11:15:25 +0000 Subject: [PATCH 05/15] CI: Be explicit with channels to pass --- test/test_environment_bench.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_environment_bench.py b/test/test_environment_bench.py index 593945164..ae6197cc0 100644 --- a/test/test_environment_bench.py +++ b/test/test_environment_bench.py @@ -23,6 +23,7 @@ "repo": ".", "branches": ["main"], "environment_type": "virtualenv", + "conda_channels": ["conda-forge", "nodefaults"], "env_dir": ".asv/env", "results_dir": ".asv/results", "html_dir": ".asv/html", From cddd743d39e6bfcca3fe816b42ff0d2c6fca9b17 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 11:53:23 +0000 Subject: [PATCH 06/15] CI: Minor visual cleanup --- .github/workflows/build_wheels.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index b397bf515..2027debae 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -34,7 +34,7 @@ jobs: echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT echo github.ref ${{ github.ref }} build_wheels: - name: Build wheel for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }} + name: Build wheels needs: get_commit_message if: >- contains(needs.get_commit_message.outputs.message, '[wheel build]') || @@ -59,7 +59,8 @@ jobs: steps: - uses: actions/checkout@v3 - + - name: Echo Python version and build platform + run: echo Building wheel for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }} - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} From 0e9e10ed0b0cddfb99c0c5b30242ae56ef355420 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 12:13:49 +0000 Subject: [PATCH 07/15] CI: Skip more timed out tests on pypy --- test/test_publish.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_publish.py b/test/test_publish.py index ecf51fffc..095158e41 100644 --- a/test/test_publish.py +++ b/test/test_publish.py @@ -206,6 +206,7 @@ def test_regression_double(generate_result_dir): assert regressions == expected +@pytest.mark.skipif(tools.HAS_PYPY, reason="Flaky on pypy") def test_regression_first_commits(generate_result_dir): conf, repo, commits = generate_result_dir(5 * [1] + 10 * [10]) # Ignore before 5th commit From 30324e366489b63e3e9cdfaea0dc1f46b3408196 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 12:46:16 +0000 Subject: [PATCH 08/15] BUG: Use MAMBARC correctly --- asv/plugins/mamba.py | 1 + 1 file changed, 1 insertion(+) diff --git a/asv/plugins/mamba.py b/asv/plugins/mamba.py index ecbaa0b12..62ad292e7 100644 --- a/asv/plugins/mamba.py +++ b/asv/plugins/mamba.py @@ -84,6 +84,7 @@ def _apply_condarc_settings(self, condarc_data): # Apply channel settings if 'channels' in condarc_data: self.context.channels = condarc_data['channels'] + self._mamba_channels.extend(condarc_data['channels']) # Apply channel priority settings channel_priority_map = { From a8a468c7f8daa01c7044cb0bf10c03deaec07286 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 12:48:35 +0000 Subject: [PATCH 09/15] TST: Add more explicit mamba tests --- test/test_environment_bench.py | 196 +++++++++++++++++++++++++++------ 1 file changed, 163 insertions(+), 33 deletions(-) diff --git a/test/test_environment_bench.py b/test/test_environment_bench.py index ae6197cc0..16da504a6 100644 --- a/test/test_environment_bench.py +++ b/test/test_environment_bench.py @@ -27,6 +27,9 @@ "env_dir": ".asv/env", "results_dir": ".asv/results", "html_dir": ".asv/html", + "matrix": { + "asv_runner": [], # On conda-forge, not defaults + }, } BENCHMARK_CODE = """ @@ -51,49 +54,67 @@ def time_max(self): ) """ +CONDARC_CONTENT = """ +channels: + - conda-forge + - nodefaults +channel_priority: disabled +auto_activate_base: false +""" + -@pytest.fixture(scope="session", autouse=True) -def setup_asv_project(tmp_path_factory): +@pytest.fixture(scope="session") +def asv_project_factory(tmp_path_factory): """ - Fixture to set up an ASV project in a temporary directory + Factory to set up an ASV project with customizable configurations. """ - tmp_path = tmp_path_factory.mktemp("asv_project") - original_dir = os.getcwd() - os.chdir(tmp_path) - - os.makedirs("benchmarks", exist_ok=True) - with open("benchmarks/example_bench.py", "w") as f: - f.write(BENCHMARK_CODE) - with open("benchmarks/__init__.py", "w") as f: - f.write("") - with open("asv.conf.json", "w") as f: - json.dump(ASV_CONFIG, f, indent=4) - with open("setup.py", "w") as f: - f.write(SETUP_CODE) - - subprocess.run(["git", "init"], cwd=tmp_path, check=True) - subprocess.run( - ["git", "config", "user.email", "test@example.com"], cwd=tmp_path, check=True - ) - subprocess.run( - ["git", "config", "user.name", "Test User"], cwd=tmp_path, check=True - ) - subprocess.run(["git", "add", "."], cwd=tmp_path, check=True) - subprocess.run( - ["git", "commit", "-m", "Initial ASV setup"], cwd=tmp_path, check=True - ) - subprocess.run(["git", "branch", "-M", "main"], cwd=tmp_path, check=True) - yield tmp_path - os.chdir(original_dir) + def _create_asv_project(custom_config=None, create_condarc=False): + tmp_path = tmp_path_factory.mktemp("asv_project") + original_dir = os.getcwd() + os.chdir(tmp_path) + + os.makedirs("benchmarks", exist_ok=True) + benchmark_file = tmp_path / "benchmarks" / "example_bench.py" + benchmark_file.write_text(BENCHMARK_CODE) + (tmp_path / "benchmarks" / "__init__.py").write_text("") + + config = ASV_CONFIG.copy() + if custom_config: + config.update(custom_config) + (tmp_path / "asv.conf.json").write_text(json.dumps(config, indent=4)) + (tmp_path / "setup.py").write_text(SETUP_CODE) + + if create_condarc: + (tmp_path / ".condarc").write_text(CONDARC_CONTENT) + + subprocess.run(["git", "init"], cwd=tmp_path, check=True) + subprocess.run( + ["git", "config", "user.email", "test@example.com"], + cwd=tmp_path, + check=True, + ) + subprocess.run( + ["git", "config", "user.name", "Test User"], cwd=tmp_path, check=True + ) + subprocess.run(["git", "add", "."], cwd=tmp_path, check=True) + subprocess.run( + ["git", "commit", "-m", "Initial ASV setup"], cwd=tmp_path, check=True + ) + subprocess.run(["git", "branch", "-M", "main"], cwd=tmp_path, check=True) + + os.chdir(original_dir) + return tmp_path + + return _create_asv_project @pytest.mark.parametrize("env", ENVIRONMENTS) -def test_asv_benchmark(setup_asv_project, env): +def test_asv_benchmark(asv_project_factory, env): """ Test running ASV benchmarks in the specified environment. """ - project_dir = setup_asv_project + project_dir = asv_project_factory(custom_config={}) subprocess.run(["asv", "machine", "--yes"], cwd=project_dir, check=True) result = subprocess.run( ["asv", "run", "--quick", "--dry-run", "--environment", env], @@ -104,3 +125,112 @@ def test_asv_benchmark(setup_asv_project, env): assert ( result.returncode == 0 ), f"ASV benchmark failed in {env} environment: {result.stderr}" + + +@pytest.mark.parametrize( + "config_modifier, expected_success, expected_error", + [ + pytest.param( + {"conda_channels": ["conda-forge", "nodefaults"]}, + True, + None, + id="with_conda_forge", + ), + pytest.param( + {"conda_channels": []}, + False, + "Solver could not find solution", + id="empty_conda_channels", + ), + ], +) +def test_asv_mamba( + asv_project_factory, config_modifier, expected_success, expected_error +): + """ + Test running ASV benchmarks with various configurations, + checking for specific errors when failures are expected. + """ + project_dir = asv_project_factory(custom_config=config_modifier) + try: + subprocess.run( + ["asv", "run", "--quick", "--dry-run", "--environment", "mamba"], + cwd=project_dir, + check=True, + capture_output=True, + text=True, + ) + if not expected_success: + pytest.fail("Expected failure, but succeeded") + except subprocess.CalledProcessError as exc: + if expected_success: + pytest.fail(f"ASV benchmark unexpectedly failed: {exc.stderr}") + elif expected_error and expected_error not in exc.stderr: + pytest.fail( + f"Expected error '{expected_error}' not found in stderr: {exc.stderr}" + ) + + +@pytest.mark.parametrize( + "create_condarc, set_mambarc, expected_success, expected_error", + [ + pytest.param( + True, + True, + True, + None, + id="with_proper_condarc_and_mambarc", + ), + pytest.param( + True, + False, + False, + "Solver could not find solution", + id="with_condarc_but_no_mambarc", + ), + pytest.param( + False, + False, + False, + "Solver could not find solution", + id="without_condarc_and_mambarc", + ), + ], +) +@pytest.mark.skipif(not tools.HAS_MAMBA, + reason="needs mamba") +def test_asv_mamba_condarc( + asv_project_factory, + create_condarc, + set_mambarc, + expected_success, + expected_error, + monkeypatch, +): + project_dir = asv_project_factory( + custom_config={"conda_channels": [], "environment_type": "mamba"}, + create_condarc=create_condarc, + ) + + env = os.environ.copy() + if set_mambarc: + env["MAMBARC"] = str(project_dir.resolve() / ".condarc") + + try: + subprocess.run( + ["asv", "run", "--quick", "--dry-run"], + cwd=project_dir, + check=True, + capture_output=True, + text=True, + env=env, + ) + if not expected_success: + pytest.fail("Expected failure, but succeeded") + except subprocess.CalledProcessError as exc: + if expected_success: + pytest.fail(f"ASV benchmark unexpectedly failed: {exc.stderr}") + elif expected_error and expected_error not in exc.stderr: + pytest.fail( + f"Expected error '{expected_error}' not found in stderr: {exc.stderr}" + ) From 65822cc773f9565525f0339018ca2e7422c6015b Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 13:28:11 +0000 Subject: [PATCH 10/15] CI: Add both MacOS and Windows tests --- .github/workflows/ci.yml | 2 +- .github/workflows/ci_win.yml | 72 ++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci_win.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67741b2c5..a71b138de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: test_env: name: test_environments - runs-on: "ubuntu-latest" + runs-on: [ "ubuntu-latest", "macos-latest" ] strategy: fail-fast: false timeout-minutes: 10 diff --git a/.github/workflows/ci_win.yml b/.github/workflows/ci_win.yml new file mode 100644 index 000000000..64ec04ffa --- /dev/null +++ b/.github/workflows/ci_win.yml @@ -0,0 +1,72 @@ +name: Windows CI + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: test + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["windows-latest"] + python-version: ["3.7"] + timeout-minutes: 30 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python version ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: pyproject.toml + + - name: Install and test + shell: pwsh + run: | + python.exe -m pip install .[test] + python.exe -m pip install packaging virtualenv + python.exe -m pytest -v -l -x --timeout=300 --durations=100 test --environment-type=virtualenv + + + test_env: + name: test_environments + runs-on: "ubuntu-latest" + strategy: + fail-fast: false + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: mamba-org/setup-micromamba@v1 + with: + init-shell: >- + powershell + environment-name: test-env + cache-environment: true + create-args: >- + python + pip + libmambapy + conda-build + + - name: Install dependencies + run: python -m pip install ".[test,hg]" --pre + shell: micromamba-shell {0} + + - name: Install asv + run: pip install . + shell: micromamba-shell {0} + + - name: Run tests + run: pytest -k environment_bench -vvvvv + shell: micromamba-shell {0} From f8db9e4653a7233cd3529bea4e27ad3e9c16a5a8 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 13:44:35 +0000 Subject: [PATCH 11/15] TST: Skip tests if mamba isn't there --- test/test_environment_bench.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_environment_bench.py b/test/test_environment_bench.py index 16da504a6..7a957f8d8 100644 --- a/test/test_environment_bench.py +++ b/test/test_environment_bench.py @@ -144,6 +144,8 @@ def test_asv_benchmark(asv_project_factory, env): ), ], ) +@pytest.mark.skipif(not tools.HAS_MAMBA, + reason="needs mamba") def test_asv_mamba( asv_project_factory, config_modifier, expected_success, expected_error ): From cc2772f316e10fd963cdfb85f89f6e20b1dd1f98 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 13:50:25 +0000 Subject: [PATCH 12/15] MAINT: Catch OSError for conda path exploration --- .github/workflows/ci.yml | 4 ++-- test/tools.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a71b138de..858d5eacc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Linux CI +name: Linux and MacOS CI on: [push, pull_request] @@ -60,7 +60,7 @@ jobs: test_env: name: test_environments - runs-on: [ "ubuntu-latest", "macos-latest" ] + runs-on: [ ubuntu-latest, macos-latest ] strategy: fail-fast: false timeout-minutes: 10 diff --git a/test/tools.py b/test/tools.py index a9703d4ee..ecf5a280f 100644 --- a/test/tools.py +++ b/test/tools.py @@ -94,14 +94,16 @@ def _check_conda(): def _check_mamba(): - conda = _find_conda() try: - importlib.import_module('libmambapy') - subprocess.check_call([conda, 'build', '--version'], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + conda = _find_conda() + importlib.import_module("libmambapy") + subprocess.check_call( + [conda, "build", "--version"], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) return True - except (ImportError, subprocess.CalledProcessError, FileNotFoundError): + except (ImportError, OSError, subprocess.CalledProcessError, FileNotFoundError): return False From cd2077959bca55c6a6bbe768a34d9fb3cc3304f9 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 14:24:39 +0000 Subject: [PATCH 13/15] TST: More pypy timeouts --- test/test_environment.py | 2 ++ test/test_publish.py | 1 + 2 files changed, 3 insertions(+) diff --git a/test/test_environment.py b/test/test_environment.py index f37133aac..1c511ea97 100644 --- a/test/test_environment.py +++ b/test/test_environment.py @@ -9,6 +9,7 @@ from asv.repo import get_repo from asv.util import shlex_quote as quote +from . import tools from .tools import (PYTHON_VER1, PYTHON_VER2, DUMMY1_VERSION, DUMMY2_VERSIONS, WIN, HAS_PYPY, HAS_CONDA, HAS_VIRTUALENV, HAS_PYTHON_VER2, generate_test_repo) @@ -682,6 +683,7 @@ def test_build_isolation(tmpdir): env.install_project(conf, repo, commit_hash) +@pytest.mark.skipif(tools.HAS_PYPY, reason="Flaky on pypy") def test_custom_commands(tmpdir): # check custom install/uninstall/build commands work tmpdir = str(tmpdir) diff --git a/test/test_publish.py b/test/test_publish.py index 095158e41..9ee43659b 100644 --- a/test/test_publish.py +++ b/test/test_publish.py @@ -442,6 +442,7 @@ def test_regression_atom_feed_update(dvcs_type, tmpdir): b_content = b.find('{http://www.w3.org/2005/Atom}content') assert a_content.text != b_content.text +@pytest.mark.skipif(tools.HAS_PYPY, reason="Flaky on pypy") def test_branch_name_is_also_filename(tmpdir): # gh-1209 tmpdir = str(tmpdir) From 3a10c144c91a179df5e9452bdc56cc890fe74792 Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 14:48:03 +0000 Subject: [PATCH 14/15] CI: Update to checkout v4 Co-authored-by: mattip --- .github/workflows/build_wheels.yml | 6 +++--- .github/workflows/ci.yml | 6 +++--- .github/workflows/ci_win.yml | 4 ++-- .github/workflows/pre-commit.yml | 4 ++-- .github/workflows/triggered.yml | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 2027debae..0211261a6 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -22,7 +22,7 @@ jobs: message: ${{ steps.commit_message.outputs.message }} steps: - name: Checkout asv - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Gets the correct commit message for pull request with: ref: ${{ github.event.pull_request.head.sha }} @@ -58,7 +58,7 @@ jobs: python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy3.8', 'pypy3.9'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Echo Python version and build platform run: echo Building wheel for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }} - uses: actions/setup-python@v4 @@ -80,7 +80,7 @@ jobs: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0'))) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build sdist shell: bash -l {0} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 858d5eacc..ff655a2fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: r-version: ['release'] timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -65,7 +65,7 @@ jobs: fail-fast: false timeout-minutes: 10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -96,7 +96,7 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: diff --git a/.github/workflows/ci_win.yml b/.github/workflows/ci_win.yml index 64ec04ffa..063f88808 100644 --- a/.github/workflows/ci_win.yml +++ b/.github/workflows/ci_win.yml @@ -17,7 +17,7 @@ jobs: python-version: ["3.7"] timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -43,7 +43,7 @@ jobs: fail-fast: false timeout-minutes: 10 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 74e5e8193..c1c35f188 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,8 +13,8 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 with: python-version: '3.9' - uses: pre-commit/action@v2.0.3 diff --git a/.github/workflows/triggered.yml b/.github/workflows/triggered.yml index 5dd19b29b..94f08ce1e 100644 --- a/.github/workflows/triggered.yml +++ b/.github/workflows/triggered.yml @@ -23,7 +23,7 @@ jobs: r-version: ['release'] timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -53,7 +53,7 @@ jobs: run: python -m pip install ".[test,hg]" - name: Get asv_runner to be tested - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: airspeed-velocity/asv_runner ref: refs/pull/${{ github.event.inputs.pr_number }}/head From 54eea8900b8d7e53e873a87c919ee5910a663eef Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Sun, 4 Feb 2024 14:49:12 +0000 Subject: [PATCH 15/15] CI: Add a strtegy for matrix and runs-on Co-authored-by: mattip --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff655a2fd..d558a7de6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,8 +60,10 @@ jobs: test_env: name: test_environments - runs-on: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} strategy: + matrix: + os: ["ubuntu-latest", "macos-latest"] fail-fast: false timeout-minutes: 10 steps: