Skip to content

Update testing documentation#314

Merged
PGijsbers merged 7 commits intomainfrom
update-dev-docs
Apr 14, 2026
Merged

Update testing documentation#314
PGijsbers merged 7 commits intomainfrom
update-dev-docs

Conversation

@PGijsbers
Copy link
Copy Markdown
Contributor

Update (parts of) the documentation to reflect current intentions.

@PGijsbers PGijsbers added the documentation Improvements or additions to documentation label Apr 14, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

Warning

Rate limit exceeded

@PGijsbers has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 15 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 50 minutes and 15 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: aa8526d5-044b-4b73-acee-c13520e6cf43

📥 Commits

Reviewing files that changed from the base of the PR and between f45a7c8 and 502ec03.

📒 Files selected for processing (2)
  • docs/contributing/tests.md
  • pyproject.toml

Walkthrough

This pull request updates developer-facing documentation and pytest configuration. It modifies the Docker Compose command in the docs service instructions to explicitly reference compose files. The tests documentation is reorganized to focus on REST API test execution and authoring with new testing conventions, including marker-based test categorization and endpoint testing patterns. Section headings are adjusted in setup documentation, and navigation is updated in mkdocs.yml. Pytest marker declarations in pyproject.toml are updated with revised descriptions and two new markers (py_api and php_api) are introduced with auto-population behavior.

Possibly related PRs

Suggested labels

tests

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Update testing documentation' clearly summarizes the main change, which involves updating documentation files related to testing, contributing guidelines, and pytest configuration.
Description check ✅ Passed The description 'Update (parts of) the documentation to reflect current intentions' is related to the changeset, which updates multiple documentation files and configuration to reflect testing and development practices.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-dev-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • The examples using py_api: httpx.AsyncClient in the docs are written as synchronous test functions and call .get() without await; consider updating them to async def tests that await py_api.get(...) to match actual async usage and avoid confusion.
  • In the test examples you use HTTPStatus.SUCCESS, which is not a standard http.HTTPStatus member; it may be clearer to use a real status constant (e.g. HTTPStatus.OK) or explicitly note that it is a placeholder.
  • The php_api marker description in pyproject.toml currently says "requests the py_api fixture"; this likely should say "requests the php_api fixture" to accurately document its behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The examples using `py_api: httpx.AsyncClient` in the docs are written as synchronous test functions and call `.get()` without `await`; consider updating them to `async def` tests that `await py_api.get(...)` to match actual async usage and avoid confusion.
- In the test examples you use `HTTPStatus.SUCCESS`, which is not a standard `http.HTTPStatus` member; it may be clearer to use a real status constant (e.g. `HTTPStatus.OK`) or explicitly note that it is a placeholder.
- The `php_api` marker description in `pyproject.toml` currently says "requests the py_api fixture"; this likely should say "requests the php_api fixture" to accurately document its behavior.

## Individual Comments

### Comment 1
<location path="pyproject.toml" line_range="130-133" />
<code_context>
+    "mut: executes a mutation on the database (even when it is cleaned up).",
+    # *_api markers included for documentation, should not be added manually.
+    "py_api: requests the py_api fixture. Added automatically.",
+    "php_api: requests the py_api fixture. Added automatically.",
 ]
 filterwarnings = [
</code_context>
<issue_to_address>
**issue (typo):** The `php_api` marker description likely refers to the wrong fixture.

The description for `php_api` likely should say it requests the `php_api` fixture rather than `py_api` to avoid confusion. If it intentionally uses `py_api` under the hood, please clarify that in the wording (e.g., that `php_api` is implemented via `py_api`).

```suggestion
    # *_api markers included for documentation, should not be added manually.
    "py_api: requests the py_api fixture. Added automatically.",
    "php_api: requests the php_api fixture (implemented via py_api). Added automatically.",
]
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.58%. Comparing base (169a224) to head (502ec03).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #314      +/-   ##
==========================================
+ Coverage   93.55%   93.58%   +0.03%     
==========================================
  Files          73       73              
  Lines        3119     3119              
  Branches      221      221              
==========================================
+ Hits         2918     2919       +1     
  Misses        143      143              
+ Partials       58       57       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (1)
docs/contributing/tests.md (1)

95-101: Add the known migration-test auth limitation to this section.

Please document that some authentication-failure paths cannot be validated via migration tests when the PHP endpoint returns XML instead of JSON, and that those cases belong in Python-side unit tests.

Based on learnings: Migration tests for OpenML API endpoints that rely on php_api for data staging cannot test authentication failure paths (Code 103) when the legacy PHP API returns XML instead of JSON; these paths should be tested in standard Python unit tests after dependent endpoints are migrated.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/contributing/tests.md` around lines 95 - 101, Add a short note to the
"migration tests" section explaining the known auth-testing limitation: state
that migration tests calling both APIs cannot validate authentication-failure
paths (Code 103) for endpoints that stage data via php_api when the legacy PHP
endpoint returns XML instead of JSON, and instruct readers to cover those cases
in Python-side unit tests after migration; reference "migration tests",
"php_api", and "Code 103" so maintainers can locate and understand the
constraint.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/contributing/tests.md`:
- Around line 27-29: Add missing language identifiers to the fenced code blocks
in docs/contributing/tests.md: tag the docker-compose command block with "bash"
(the block containing `docker compose exec python-api python -m pytest tests -m
"not php_api and not slow"`) and tag the Python test block with "python" (the
block starting with `async def test_get_dataset(py_api: httpx.AsyncClient,
php_api: httpx.AsyncClient) -> None:`) so they satisfy MD040 and improve
readability.
- Around line 85-90: The test test_get_dataset_private_access_denied sets
owner_of_that_dataset = OWNER_USER but then asserts a FORBIDDEN error, so change
the principal passed to get_dataset to a non-owner user (e.g., use a
NON_OWNER_USER constant or a different user fixture) and ensure the dataset id
(private_dataset / 42) is still owned by OWNER_USER; update the variable name
(e.g., non_owner_user) and pass that to get_dataset(user=...) so the call
correctly triggers DatasetNoAccessError in get_dataset.
- Line 47: The guidance incorrectly states tests can be filtered out with the
"php_api" marker; update the sentence to say these slow tests should be marked
with `slow` and show the correct pytest filter (e.g., `-m "not slow"`),
replacing the reference to `php_api` with `slow` so the line clearly advises
using the `slow` marker to exclude these tests.
- Around line 62-74: The two test functions
test_get_dataset_identifier_validation and test_get_dataset_success are
currently defined with def but call py_api.get() asynchronously; change their
signatures to async def and await the py_api.get(...) calls (e.g., await
py_api.get("/datasets/1")) and keep/assert the expected HTTPStatus
(HTTPStatus.OK) and expected JSON result in test_get_dataset_success; update
both functions accordingly so they run as async tests.

In `@pyproject.toml`:
- Line 132: The php_api marker description incorrectly says it "requests the
py_api fixture"; update the marker text in pyproject.toml so it correctly
references the php_api fixture (matching the actual fixture defined as php_api
in tests/conftest.py) — locate the php_api marker entry and replace the mention
of py_api with php_api to ensure the description and the fixture name (php_api)
are consistent.

---

Nitpick comments:
In `@docs/contributing/tests.md`:
- Around line 95-101: Add a short note to the "migration tests" section
explaining the known auth-testing limitation: state that migration tests calling
both APIs cannot validate authentication-failure paths (Code 103) for endpoints
that stage data via php_api when the legacy PHP endpoint returns XML instead of
JSON, and instruct readers to cover those cases in Python-side unit tests after
migration; reference "migration tests", "php_api", and "Code 103" so maintainers
can locate and understand the constraint.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8195109b-278e-4c92-9695-234eb85d599a

📥 Commits

Reviewing files that changed from the base of the PR and between 169a224 and f45a7c8.

📒 Files selected for processing (5)
  • docs/contributing/documentation.md
  • docs/contributing/setup.md
  • docs/contributing/tests.md
  • mkdocs.yml
  • pyproject.toml

@PGijsbers PGijsbers merged commit 68c8435 into main Apr 14, 2026
9 checks passed
@PGijsbers PGijsbers deleted the update-dev-docs branch April 14, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant