PDFCLOUD-5595 Improve testing speed#31
Merged
datalogics-cgreen merged 5 commits intopdfrest:mainfrom Feb 20, 2026
Merged
Conversation
- Introduced a daily cron schedule at 7:00 AM to trigger workflows. - Added a dedicated "Live Tests" job for Python 3.11: - Configured to run on pull requests and scheduled events. - Includes live tests marked with the `live` pytest marker. - Uploads coverage results for live test runs. - Updated `pytest_collection_modifyitems` to mark live tests automatically. - Defined a `live` marker in `pyproject.toml` for consistent usage. - Removed `ci-live` environment from general test jobs and updated live-specific conditions. Assisted-by: Codex
…sing - Updated `nox` commands in `test-and-publish.yml` to use `-n 5` for parallel pytest execution in both regular and live tests. - Ensures faster test completion while maintaining existing markers like `not live` and `live`. Assisted-by: Codex
✅ Deploy Preview for pdfrest-python ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40211008af
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Move TestLiveFileDownloads from tests/test_files.py -> tests/live/test_live_file_downloads.py - Move TestLiveAsyncFileDownloads from tests/test_files.py -> tests/live/test_live_file_downloads.py - Keep mocked coverage in tests/test_files.py via TestDownloadHelpers and TestAsyncDownloadHelpers so non-live CI remains fully covered Assisted-by: Codex
- Add non-live sync and async coverage for optional payload branches (output/output_prefix/pages/page_groups) in each endpoint's home test module - Add async preview_redactions unit coverage in test_pdf_redaction_preview - Keep coverage aligned with endpoint ownership instead of a shared cross-endpoint helper module - Update TESTING_GUIDELINES.md to require endpoint-home tests and optional-branch coverage in both sync and async customization/success cases Assisted-by: Codex
- Added `_is_live_test_path` utility to identify live test paths more robustly. - Updated `pytest_collection_modifyitems` to use `Path` objects and the new utility for determining live test markers. - Ensures compatibility with varied file path formats and improves maintainability. Assisted-by: Codex
datalogics-cgreen
approved these changes
Feb 20, 2026
Contributor
datalogics-cgreen
left a comment
There was a problem hiding this comment.
LGTM
No critical findings from Codex audit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PDFCLOUD-5595
Why this change
Our CI runtime and flake exposure were higher than needed because live API tests ran in the full
testsmatrix on both pushes and pull requests across Python 3.10–3.14. That made every update slower and tied routine feedback to external service availability. This change keeps live coverage as a quality gate while reducing redundant cost on everyday branch activity.After splitting live/non-live lanes, we also needed to preserve function-level coverage for customer-facing classes without relying on live suites, because the class-function coverage gate is evaluated from the non-live coverage artifact.
What changed (high level)
We split test execution into non-live and live lanes, then scoped where each lane runs:
livepytest marker inpyproject.toml.tests/conftest.pyfor:tests/live/test_live_*test-and-publish.yml:testsjob now runs only non-live tests (-m "not live") across Python 3.10–3.14.live-testsjob running only live tests (-m live) on Python 3.11.live-testsruns onpull_requestand nightlyschedule(cron).-n 5for both non-live and live jobs.tests/test_files.pytotests/live/test_live_file_downloads.pyso they are unambiguously routed to the live lane.Coverage follow-up (non-live gate hardening):
output,output_prefix,pages,page_groups, redaction preview payloads) that were previously under-covered when live tests moved out of the non-live lane.preview_redactionsunit coverage intests/test_pdf_redaction_preview.py.TESTING_GUIDELINES.mdto require endpoint-home test ownership and optional-branch coverage in both sync and async customization/success tests.Tradeoff: live coverage is no longer exercised in all Python versions on every push, but remains enforced before merge and is checked nightly.
Behavior changes
CI behavior now differs by event type:
push:testsmatrix (3.10–3.14): non-live only, 5 workers.examplesmatrix unchanged.pull_request:live-testsgate on Python 3.11, 5 workers.live-testson Python 3.11.Test location behavior:
TestLiveFileDownloadsandTestLiveAsyncFileDownloadsnow execute only fromtests/live/test_live_file_downloads.py.tests/test_files.py(TestDownloadHelpersandTestAsyncDownloadHelpers) for non-live gating.No SDK runtime/API behavior changed; this is CI/test routing and test organization only.
Validation
Validated the live/non-live split and test routing:
uv run pytest --collect-only -m live -quv run pytest --collect-only -m "not live" -quv run pytest --collect-only -m "not live" -q tests/test_files.py tests/live/test_live_file_downloads.pyuv run pytest --collect-only -m live -q tests/test_files.py tests/live/test_live_file_downloads.pyValidated endpoint-home coverage updates:
uv run ruff checkon modified endpoint test modulesuv run pyteston modified endpoint test modulesValidated non-live coverage gate behavior with the same failing command path:
uvx nox --python 3.10 --session tests -- -n 5 -m "not live"uv run python scripts/check_class_function_coverage.py coverage/py3.10/coverage.json --class PdfRestClient --class AsyncPdfRestClient --class _FilesClient --class _AsyncFilesClient --fail-under 90 --markdown-report coverage/py3.10/class-function-coverage.mdResult: class-function coverage gate passes from non-live coverage artifacts.
Limitation: full multi-version nox matrix was not rerun locally for this follow-up; validation focused on the exact non-live gate path and impacted test modules.
Risks and follow-ups
Main risk is classification drift: a new live test that does not live under
tests/live/and does not use thetest_live_*naming pattern could be routed incorrectly. The current hook mitigates known patterns, and the moved class-based download tests remove one concrete misclassification source.Follow-ups to consider: