Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docstrings to public fixtures #1135

Merged
merged 3 commits into from
Sep 2, 2024

Conversation

kosdmit
Copy link
Contributor

@kosdmit kosdmit commented Jul 29, 2024

This PR adds short docstrings to quickly check available fixtures and is especially usefull for new pytest-django users.

I've noticed that some public fixtures don't have docstrings to give the ability to quickly check what this fixture does.
For example, the command pytest --fixtures shows builtin and custom fixtures with their short descriptions, but pytest-django doesn't provide them all:

...
-------------------------------------------------------------- fixtures defined from pytest_django.plugin --------------------------------------------------------------- 
django_test_environment [session scope] -- pytest_django\plugin.py:479
    Setup Django's test environment for the testing session.

django_db_blocker [session scope] -- pytest_django\plugin.py:507
    Wrapper around Django's database access.

mailoutbox -- pytest_django\plugin.py:577
    no docstring available

django_mail_patch_dns -- pytest_django\plugin.py:590
    no docstring available

django_mail_dnsname -- pytest_django\plugin.py:600
    no docstring available
...

After docstrings update:

pytest --fixtures
...
-------------------------------------------------------------- fixtures defined from pytest_django.plugin --------------------------------------------------------------- 
django_test_environment [session scope] -- pytest_django\plugin.py:479
    Setup Django's test environment for the testing session.

django_db_blocker [session scope] -- pytest_django\plugin.py:507
    Wrapper around Django's database access.

mailoutbox -- pytest_django\plugin.py:577
    A clean email outbox to which Django-generated emails are sent.

django_mail_patch_dns -- pytest_django\plugin.py:591
    Patch the server dns name used in email messages.

django_mail_dnsname -- pytest_django\plugin.py:602
    Return server dns name for using in email messages.
...

Copy link
Member

@bluetech bluetech left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@bluetech bluetech force-pushed the fixtures-doc-strings branch from 7029795 to a8e23ce Compare September 2, 2024 07:03
@bluetech bluetech merged commit b373db6 into pytest-dev:main Sep 2, 2024
3 of 16 checks passed
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