Skip to content

Split test examples using pytest-split and improve test clean-up - #1312

Open
lrandersson wants to merge 10 commits into
conda:mainfrom
lrandersson:dev-ra-1306-pytest-split
Open

Split test examples using pytest-split and improve test clean-up#1312
lrandersson wants to merge 10 commits into
conda:mainfrom
lrandersson:dev-ra-1306-pytest-split

Conversation

@lrandersson

@lrandersson lrandersson commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

This PR tests a different approach to solve #1306, related PR with another approach in #1310.
In this PR we use pytest-split and simply separates the Windows test examples into 3 groups and macOS into 2 groups.
https://github.com/jerry-git/pytest-split/tree/master

I also expanded the scope to include some test cleanup to minimize the chances of more intermittent issues with memory/disk-space related CI issues. Also removed the artifact archiving since it seems not to be used.

Benchmarks:
#1306 (comment)

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@lrandersson lrandersson self-assigned this Aug 3, 2026
@github-project-automation github-project-automation Bot moved this to 🆕 New in 🔎 Review Aug 3, 2026
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Aug 3, 2026
Comment thread pyproject.toml
"examples",
]
addopts = [
"--store-durations", # pytest-split, update duration cache

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lrandersson
lrandersson force-pushed the dev-ra-1306-pytest-split branch from 7194cca to 379a130 Compare August 4, 2026 13:55
@lrandersson
lrandersson force-pushed the dev-ra-1306-pytest-split branch from 8e3ee06 to f8d220a Compare August 5, 2026 13:02
exit 1
fi

# mamba occasionally fails to load libmamba.2.dylib on macOS CI right after

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes in this file is to see if it resolves the intermittent issue:

INFO:constructor.main:Successfully created '/private/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/pytest-of-runner/pytest-1/test_example_miniforge_mamba2_0/installer/Miniforge3-mamba2-25.1.1-0-MacOSX-arm64.sh'.

dyld[31994]: Library not loaded: @rpath/libmamba.2.dylib
  Referenced from: <A07BA708-81EE-3434-9A5E-50BBA7FCC449> /private/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/pytest-of-runner/pytest-1/test_example_miniforge_mamba2_0/install/batch/pkgs/mamba-2.0.8-h105ca85_2/bin/mamba
  Reason: tried: '/private/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/pytest-of-runner/pytest-1/test_example_miniforge_mamba2_0/install/batch/pkgs/mamba-2.0.8-h105ca85_2/bin/../lib/libmamba.2.dylib' (no such file), '/private/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/pytest-of-runner/pytest-1/test_example_miniforge_mamba2_0/install/batch/pkgs/mamba-2.0.8-h105ca85_2/bin/../lib/libmamba.2.dylib' (no such file), '/usr/local/lib/libmamba.2.dylib' (no such file), '/usr/lib/libmamba.2.dylib' (no such file, not in dyld cache)
/private/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/pytest-of-runner/pytest-1/test_example_miniforge_mamba2_0/install/batch/pkgs/post_install.sh: line 48: 31994 Abort trap: 6           mamba info
ERROR: executing post_install.sh failed

When debugging it seems like mamba --version passes, but mamba info directly after fails. Therefore, perhaps this will help mitigate the flakiness of this test.

@lrandersson lrandersson changed the title Split test examples using pytest-split Split test examples using pytest-split and improve test clean-up Aug 5, 2026
@lrandersson
lrandersson marked this pull request as ready for review August 5, 2026 19:44
@lrandersson
lrandersson requested a review from a team as a code owner August 5, 2026 19:44
Comment thread .github/workflows/main.yml Outdated
jobs:
tests:
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, ${{ matrix.conda-standalone }}
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, ${{ matrix.conda-standalone }}${{ matrix.split-group && format(', group {0}/3', matrix.split-group) || '' }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are only deploying two groups for macOS, hard-coding 3 makes it looks like tests are missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch (see below)

Comment thread .github/workflows/main.yml Outdated
conda-standalone: conda-standalone-onedir
check-docs-schema: true
# MACOS
# MACOS (split into 2 groups per Python version)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why split macOS in two groups? Because of the queue? This matrix is hard to manage with every scenario hard-coded.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I wasn't planning on modifying macOS, but then I did anyway for testing purposes, and then I did 2 groups instead of 3 because we always have to sit and wait for the macOS runner queue.
I've now split it into 3 groups: 592f6cf
I'm also fine just leaving macOS as is (no split at all) since the main bottle neck is Windows, but I still think doing something about macOS would be good for us since sometimes the test duration reach almost 90 minutes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we should split macOS. I don't mind it being split in two necessarily as long as we don't introduce coverage gaps. Runner availability is a real concern for sure.

Comment thread .github/workflows/main.yml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

3 participants