Convert unittest-style tests to pytest and drop the PT exemptions
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
Research direction
Start with the per-file-ignores table in pyproject.toml to see which test files are exempt from the PT rules, then pick one small file such as config/tests/test_database_url.py and rewrite its TestCase methods as plain functions using assert and pytest.raises. Run uv run ruff check . and uv run pytest on that file. Leave the unittest-style probe string in config/tests/test_parallel_spawn.py as it is, since manage.py test needs it. Done means the file's exemption is removed, coverage is unchanged, and both commands pass.
Written by the indexing model from the issue text.
Description
The contributing guide says to write tests with pytest and plain assert. Ruff's pytest-style rules (PT, including PT009 and PT027) now check that, but 16 older test files are exempt through per-file-ignores in pyproject.toml because they still subclass Django's TestCase or SimpleTestCase and use self.assert* and assertRaises.
Files:
apps/accounts/tests/test_admin.pyapps/accounts/tests/test_ascii_policy.pyapps/accounts/tests/test_createsuperuser.pyapps/accounts/tests/test_models.pyapps/accounts/tests/test_review_fixes.pyapps/accounts/tests/test_review_fixes_2.pyapps/accounts/tests/test_review_fixes_3.pyapps/accounts/tests/test_review_fixes_4.pyconfig/tests/test_cache.pyconfig/tests/test_celery_review_fixes.pyconfig/tests/test_database_url.pyconfig/tests/test_email_backend.pyconfig/tests/test_parallel_spawn.pyconfig/tests/test_settings.pyconfig/tests/test_settings_env_file.pyconfig/tests/test_settings_review_fixes.py
config/tests/test_celery.py also subclasses TestCase but has no PT hits, so it is not exempt. Convert it in the same pass.
Work
- Rewrite each file with plain functions,
assert,pytest.raises, and fixtures (db,settings,monkeypatch, factories) in place ofTestCasemethods. - Remove the file's entry from
per-file-ignoresin the same change. Files can go in separate pull requests. - Keep every test's intent. Coverage must not drop.
Check first
config/tests/test_parallel_spawn.pyruns a probe suite throughmanage.py test --parallel 2. The probe is a string ofSimpleTestCasecode that must stay unittest-style, becausemanage.py testonly discovers those. Convert only the outer test.
Done when
per-file-ignoresinpyproject.tomlhas noPTentries.uv run ruff check .anduv run pytestpass.
- Dominant language
- Python
- Stars
- 0
- Forks
- 1
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 206
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openpickleball/backend
-
area:infra documentation priority:p2 size:S
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openpickleball/backend#472 ·
Maintainers usually reply within 1 day
-
Show doctl's error when the Deploy workflow's update failsPossibly taken @GeoBradDev claimed this today. Openarea:infra bug priority:p2 size:S
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openpickleball/backend#471 ·
Maintainers usually reply within 1 day
-
area:infra documentation type:chore
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
openpickleball/backend#196 ·
Maintainers usually reply within 1 day
-
area:infra type:chore
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openpickleball/backend#195 ·
Maintainers usually reply within 1 day
-
area:api enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
openpickleball/backend#470 ·
Maintainers usually reply within 1 day
All issues in openpickleball/backend
Similar issues
-
bug(operator): VolterraOperator built inside jax.jit with a concrete decay raises TracerBoolConversionErrorPossibly taken @jejjohnson claimed this today. Opentype:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jejjohnson/integrix#144 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
finos/ai-governance-framework#459 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#2963 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
freelawproject/litigant-portal#1307 ·
Maintainers usually reply within 2 days
-
type/bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
h2oai/h2o-llmstudio#1163 ·
Maintainers usually reply within 1 day