Skip to content

Commit 1a5a3d1

Browse files
committed
Enables parallel pytest execution
Speeds up testing by enabling parallel execution of pytest using the `-n auto` flag. Adds `pytest-xdist` as a dependency for parallel testing. Removes the redundant conda environment caching from the `update-cache.yml` workflow, as environment caching is already managed in the CI workflow, and adds `CONDA_ALWAYS_YES` and `MAMBA_ALWAYS_YES` variables to automatically accept prompts. Also adds the `--strict-channel-priority` flag when creating or updating the conda environment to ensure channel priorities are respected.
1 parent bc6b9dd commit 1a5a3d1

6 files changed

Lines changed: 13 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ jobs:
9191
- name: Install all extras - CI
9292
shell: micromamba-shell {0}
9393
working-directory: ARC
94+
env:
95+
MAMBA_ALWAYS_YES: "true"
96+
CONDA_ALWAYS_YES: "true"
9497
run: make install-ci
9598

9699
- name: Set TS-GCN and AutoTST in PYTHONPATH
@@ -111,15 +114,15 @@ jobs:
111114
run: |
112115
echo "Running Unit Tests..."
113116
export PYTHONPATH="${{ github.workspace }}/AutoTST:${{ github.workspace }}/KinBot:$PYTHONPATH"
114-
pytest arc/ --cov --cov-report=xml -ra -vv
117+
pytest arc/ --cov --cov-report=xml -ra -vv -n auto
115118
116119
- name: Run Functional Tests
117120
shell: micromamba-shell {0}
118121
working-directory: ${{ github.workspace }}/ARC
119122
run: |
120123
echo "Running Functional Tests from $(pwd)..."
121124
export PYTHONPATH="${{ github.workspace }}/AutoTST:${{ github.workspace }}/KinBot:$PYTHONPATH"
122-
pytest functional/ -ra -vv
125+
pytest functional/ -ra -vv -n auto
123126
124127
- name: Upload coverage data
125128
uses: codecov/codecov-action@v3

.github/workflows/update-cache.yml

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -111,32 +111,4 @@ jobs:
111111
ref: v2.0.6
112112
fetch-depth: 1
113113

114-
# ────────── Conda package cache ──────────
115-
- name: Cache Conda packages
116-
id: cache-conda-pkgs
117-
uses: actions/cache@v4
118-
with:
119-
path: ~/conda_pkgs_dir
120-
key: ${{ runner.os }}-conda-0-${{ hashFiles('environment.yml') }}
121-
122-
# ────────── Create / restore env ──────────
123-
- name: Setup ARC Env
124-
uses: conda-incubator/setup-miniconda@v3.2.0
125-
with:
126-
auto-update-conda: true
127-
environment-file: environment.yml
128-
activate-environment: arc_env
129-
miniconda-version: latest
130-
conda-solver: libmamba
131-
132-
# ────────── Update env & save to cache ──────────
133-
- name: Update environment
134-
run: conda env update -n arc_env -f environment.yml
135-
136-
- name: Cache ARC env
137-
if: github.event_name == 'push'
138-
uses: actions/cache@v4
139-
with:
140-
path: ${{ env.CONDA }}/envs
141-
key: conda-${{ runner.os }}-${{ runner.arch }}-0
142-
114+
# ────────── Env caching handled in CI workflow ──────────

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ help:
5050
test: test-unittests
5151

5252
test-unittests:
53-
pytest arc/ --cov --cov-report=xml -ra -vv
53+
pytest arc/ --cov --cov-report=xml -ra -vv -n auto
5454

5555
test-functional:
56-
pytest functional/ -ra -vv
56+
pytest functional/ -ra -vv -n auto
5757

5858
test-all:
59-
pytest arc/ functional/ --cov --cov-report=xml -ra -vv
59+
pytest arc/ functional/ --cov --cov-report=xml -ra -vv -n auto
6060

6161
install-all: install
6262

devtools/install_rmg.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ fi
104104

105105
if $COMMAND_PKG env list | awk '{print $1}' | grep -qx "$ENV_NAME"; then
106106
echo ">>> Updating existing environment: $ENV_NAME"
107-
$COMMAND_PKG env update -n "$ENV_NAME" -f environment.yml --prune
107+
$COMMAND_PKG env update -n "$ENV_NAME" -f environment.yml --prune --strict-channel-priority
108108
else
109109
echo ">>> Creating new environment: $ENV_NAME"
110-
$COMMAND_PKG env create -n "$ENV_NAME" -f environment.yml -y
110+
$COMMAND_PKG env create -n "$ENV_NAME" -f environment.yml -y --strict-channel-priority
111111
fi
112112

113113
###############################################################################

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ dependencies:
3939
- conda-forge::pytables
4040
- conda-forge::pytest
4141
- conda-forge::pytest-cov
42+
- conda-forge::pytest-xdist
4243
- conda-forge::pyyaml
4344
- conda-forge::rdkit >=2025.03
4445
- conda-forge::scipy

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ sphinxcontrib-jsmath
3232
# For running the unit tests
3333
pytest
3434
pytest-cov
35+
pytest-xdist
3536
coverage
3637

3738
# For interactive use

0 commit comments

Comments
 (0)