Skip to content

Let other packages use the test fixtures as a pytest plugin - #37

Merged
hunterhogan merged 2 commits into
mainfrom
claude/peaceful-cori-cdyr0z
Nov 29, 2026
Merged

hunterhogan merged 2 commits into
mainfrom
claude/peaceful-cori-cdyr0z

Conversation

@hunterhogan

@hunterhogan hunterhogan commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

A package that counts or generates with mapFolding can now test its own algorithms with mapFolding's fixtures. It adds mapFolding[testing] to its testing dependencies and registers the plugin in its root conftest.py:

pytest_plugins = ('mapFolding.tests.conftest',)

Changes

  • testing extra: hypothesis, packaging, pandas, pyarrow, pytest>=9.0, and pytest-xdist. These cover what mapFolding.tests imports, including packaging, which commandImport imports. The pandas and pyarrow entries serve the fixtures that read dataSamples. Since main made dulwich and pandas lazy imports, the extra no longer needs dulwich.
    • The testing dependency group now names mapFolding[testing] instead of repeating the list. I checked that both pip (-e . --group testing) and uv resolve a group that names its own project's extra.
    • test_optionalDependencies gains a testing row. It checks that mapFolding.tests, mapFolding.tests.conftest, and mapFolding.tests.conftestAnnex import after pip install mapFolding[testing].
  • Package data: the .album and .pkl files in tests/dataSamples. The released wheels ship the .py samples but not these files, so getDataFrameFoldings fails outside a checkout, and so do the arrayFoldings, albumKnown, and pathAlbum fixtures. This adds about 600 KB to the wheel.
  • New identifiers fixture: given a Default through indirect parametrization, it points that Default's pathRoot at a directory that one test owns. The change is made in place with patch.dict and undone after the test, so it also redirects a generator's entry point that reads the module-level Default and takes no arguments.
  • argv fixture removed: the pytest skill does not allow a general-purpose argv fixture, and shipping one in a public plugin would spread it to other packages. test_OEIS_for_n and test_OEIS_for_nError now set sys.argv with monkeypatch.
  • README: new section "Test your own algorithms with the mapFolding tests". It also fixes stale references: test_algorithms.py and test_oeis_byFormula.py do not exist, and .[development,testing] named extras that are dependency groups.

Verification

  • After merging main: 13139 passed and 2 xfailed with -n 4. Before this PR the count was 13134; the five additional tests are test_pyproject.py with its new testing row.
  • Removing pytest and pytest-xdist from the extra makes the testing row fail. Removing only one of them does not, because pytest-xdist requires pytest.
  • From a wheel built from this branch and installed in a separate project, without editable mode and without dulwich: the plugin loads, expected and identifiers work, and getDataFrameFoldings reads the packaged .pkl.
  • Ruff and isort are clean on the changed files.

A release is needed before downstream packages can require this.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GMd3z8bGZQ5aV7bsZxiFzi

A package that counts or generates with mapFolding registers
`pytest_plugins = ('mapFolding.tests.conftest',)` and receives the fixtures by name.

- `testing` extra: installs everything `mapFolding.tests` imports, including dulwich, without
  which `mapFolding.oeis` cannot be imported. The `testing` group now builds on it.
- Package data: the `.album` and `.pkl` samples in `tests/dataSamples`. Without the `.pkl`
  files, the released `getDataFrameFoldings` and the `arrayFoldings` fixture fail outside a checkout.
- `identifiers` fixture: a `Default` whose `pathRoot` is a directory one test owns, changed in
  place, so a generator and its entry point write there.
- `argv` fixture removed: the `OEIS_for_n` tests set `sys.argv` with `monkeypatch`.
- README: how to test your own algorithms, and corrected test module names and install command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMd3z8bGZQ5aV7bsZxiFzi
@hunterhogan
hunterhogan marked this pull request as ready for review November 29, 2026 20:45
main made `dulwich` and `pandas` lazy imports, so the `testing` extra no longer needs `dulwich`.
The extra gains `packaging`, which `commandImport` in `conftest.py` imports, and
`test_optionalDependencies` checks that the extra lets `mapFolding.tests`, its plugin
`conftest.py`, and `conftestAnnex.py` import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GMd3z8bGZQ5aV7bsZxiFzi
@hunterhogan
hunterhogan merged commit ae3ba7a into main Nov 29, 2026
6 checks passed
@hunterhogan hunterhogan mentioned this pull request Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants