-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add example for __test__ #7733
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 example for __test__ #7733
Conversation
Initially, I'd added my name to AUTHORS based on the PR prompt, but after reading the CONTRIBUTING guidelines in more detail, decided it wasn't warranted. I also cut the documentation down to 80 chars per line. For my development, is there something like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @JosephTLucas, please take a look at my comments. 👍
doc/en/example/pythoncollection.rst
Outdated
.. code-block:: python | ||
# Will be discovered as a test | ||
def test_class: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_class: | |
class TestClass: |
doc/en/example/pythoncollection.rst
Outdated
collect_ignore_glob = ["*_py2.py"] | ||
User modules with names matching ``test*.py`` may be discovered as tests. Since | ||
Pytest 2.6, users can prevent this test discovery by setting a boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pytest 2.6, users can prevent this test discovery by setting a boolean | |
Pytest 2.6, users can prevent pytest from discovering classes that start with ``Test`` by setting a boolean ``__test__`` attribute to ``False``. |
Also I think we only need the example with False
set; otherwise the example using __test__ = True
implies that pytest will discover the class for tests even if it doesn't match the python_classes
configuration option, which is not true.
Thanks @nicoddemus ! Changes made. |
Thanks @JosephTLucas! |
PR reference: https://twitter.com/pytestdotorg/status/1302444196842725376?s=20
This example page seemed to be the best location. Anywhere else you recommend?