Skip to content

Add pytest test suite#334

Merged
gforcada merged 9 commits into2.xfrom
tests/add-pytest-suite
Mar 16, 2026
Merged

Add pytest test suite#334
gforcada merged 9 commits into2.xfrom
tests/add-pytest-suite

Conversation

@jensens
Copy link
Member

@jensens jensens commented Feb 28, 2026

Summary

  • Add comprehensive pytest test suite with 113 tests covering all modules
  • Add test infrastructure: [project.optional-dependencies], [tool.pytest.ini_options], [testenv:test] in tox
  • All shared utilities at 100% coverage, 75% overall
  • Tests use tmp_path fixtures and unittest.mock to avoid real subprocess/git calls

Coverage breakdown

Module Coverage
shared/ (utils, packages, path, call, git) 100%
multi_call.py 100%
re_enable_actions.py 88%
pep_420.py 76%
config_package.py 68%
Overall 75%

Test plan

  • uv run --extra test pytest -v — 113 tests pass
  • uv run --extra test pytest --cov=plone.meta — 75% coverage
  • No real subprocess calls (git/tox/gh) are executed during tests
  • Review test structure and mocking patterns

🤖 Generated with Claude Code

@jensens jensens marked this pull request as ready for review March 1, 2026 00:43
@gforcada
Copy link
Member

gforcada commented Mar 1, 2026

Before looking at the code, I'm not sure how worth it is to add a test suite to these set of scripts really...

The code is in a state that only minimal changes and fixes are being done and very few new features are added, and those would probably break plenty of tests which might or might not be that useful.

Anyway, I wanted to give this first impression before reviewing the code.

Copy link
Member

@gforcada gforcada left a comment

Choose a reason for hiding this comment

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

Nice job, and I'm specially grateful that you used some AI to generate them, as I find them not that useful in practice, but as you did not have (hopefully) to spend too much time on it, then it is not too bad.

I'm +1 on the test_shared ones, but rather +0 to -1 for the test_config_package.py tests, as they might be quite brittle to maintain as we evolve the script.

@jensens
Copy link
Member Author

jensens commented Mar 1, 2026

Do we need testing this? As you noticed I am exploring to work with AI agents on code. Having tests is the only sane way to have a verification loop there and catch regressions. And for humans it doe not hurt too.

@gforcada gforcada force-pushed the tests/add-pytest-suite branch 7 times, most recently from 12bf736 to dced8e2 Compare March 15, 2026 15:24
@gforcada gforcada changed the title Add pytest test suite (113 tests, 75% coverage) Add pytest test suite Mar 15, 2026
@gforcada gforcada self-requested a review March 15, 2026 15:24
gforcada and others added 9 commits March 16, 2026 08:40
It is not used anywhere.
As we never touched this file it was still pointing to `zopefoundation`
organization.
As it was copied and forgot, the GHA filename was never updated.
Add 113 pytest tests covering all modules with 75% overall coverage.
All shared utilities achieve 100% coverage. Tests use tmp_path fixtures
and unittest.mock to avoid real subprocess/git calls.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Run pytest across all supported Python versions in CI alongside
the existing QA (lint) job.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
They basically provide not really meaningful,
as in that they will alert you if something breaks.
Skip the few one off scripts that we are not testing.
Skip test coverage on a few functions that have not really logic,
but are rather scaffolding.
@gforcada gforcada force-pushed the tests/add-pytest-suite branch from dced8e2 to a76642f Compare March 16, 2026 07:40
@gforcada gforcada merged commit fcaa068 into 2.x Mar 16, 2026
5 checks passed
@gforcada gforcada deleted the tests/add-pytest-suite branch March 16, 2026 07:42
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