-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Document which pytest features work with unittest
#2656
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
Document which pytest features work with unittest
#2656
Conversation
@nicoddemus good work, can you please add a paragraph on subtests as well |
Definitely, thanks! |
a5ce7d8
to
15cdf13
Compare
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.
Few comments on wording and overall structure, but apart from that great work @nicoddemus! 📝 👏
doc/en/unittest.rst
Outdated
to overwrite ``debug`` in the same way (this is also true for standard | ||
unittest). | ||
``pytest`` supports running Python `unittest.py style`_ tests out of the box. | ||
It's meant for leveraging existing ``unittest``-style test suites |
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.
I think, it would be better to stick to one name:
`unittest.py style`_
vs.
``unittest``-style
doc/en/unittest.rst
Outdated
``pytest`` supports running Python `unittest.py style`_ tests out of the box. | ||
It's meant for leveraging existing ``unittest``-style test suites | ||
to use pytest as a test runner and also allow to incrementally adapt | ||
the test suite to take full advantage of pytest features. |
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's features
doc/en/unittest.rst
Outdated
to use pytest as a test runner and also allow to incrementally adapt | ||
the test suite to take full advantage of pytest features. | ||
|
||
To run an existing ``unittest``-style test suite using ``pytest``, simply type:: |
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.
Remove simply
. It's redundant 😄
doc/en/unittest.rst
Outdated
Benefits | ||
-------- | ||
|
||
You can make use of several pytest features, most without changing any existing code: |
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.
You can make use of several pytest features, in most cases without having to modify existing code:
doc/en/unittest.rst
Outdated
.. _`setUpModule/tearDownModule`: https://docs.python.org/3/library/unittest.html#setupmodule-and-teardownmodule | ||
.. _`subtests`: https://docs.python.org/3/library/unittest.html#distinguishing-test-iterations-using-subtests | ||
|
||
Pytest currently does not support the following ``unittest`` features: |
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.
Up to this point pytest does not have support for the following unittest
features:
doc/en/unittest.rst
Outdated
Mixing pytest fixtures into unittest.TestCase style tests | ||
----------------------------------------------------------- | ||
|
||
pytest features in ``unittest.TestCase`` subclasses |
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.
Hmm I wonder if we can improve the structure of this document:
- unittest.TestCase Support
- Benefits
- Limitations
- pytest features in
unittest.TestCase
subclasses - Mixing pytest fixtures into
unittest.TestCase
subclasses using marks - Using autouse fixtures and accessing other fixtures
- ...
I might be better to have an introduction at the top level and mention some of the limitations and link to the according section and then list some of the most important unittest features that pytest supports?! 🤔
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.
Yeah I agree the structure is not very appealing.
We might not use RST sessions, just make the title bold instead and list benefits/limitations etc in the introduction text.
Btw you're welcome to push to my branch if you want to take a stab at this yourself. 😉
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.
I know, my friend, I know 😢
Don't have much time for FOSS at the moment. Otherwise I'd happily work on this with you.
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.
No worries! I will take a stab at this again later then. 👍
@hackebrot pushed requested changes. |
Great work @nicoddemus! 👍 |
great collaboration, thanks |
Fix #2626