Incorporate legend into main table

This commit is contained in:
Zac Hatfield-Dodds 2023-07-06 00:04:15 -07:00
parent ddd773ecb1
commit b81003f6fb
1 changed files with 16 additions and 27 deletions

View File

@ -47,8 +47,7 @@ Unsupported idioms / known issues
- nose imports test modules with the same import path (e.g. - nose imports test modules with the same import path (e.g.
``tests.test_mode``) but different file system paths ``tests.test_mode``) but different file system paths
(e.g. ``tests/test_mode.py`` and ``other/tests/test_mode.py``) (e.g. ``tests/test_mode.py`` and ``other/tests/test_mode.py``)
by extending sys.path/import semantics. pytest does not do that by extending sys.path/import semantics. pytest does not do that. Note that
but there is discussion in :issue:`268` for adding some support. Note that
`nose2 choose to avoid this sys.path/import hackery <https://nose2.readthedocs.io/en/latest/differences.html#test-discovery-and-loading>`_. `nose2 choose to avoid this sys.path/import hackery <https://nose2.readthedocs.io/en/latest/differences.html#test-discovery-and-loading>`_.
If you place a conftest.py file in the root directory of your project If you place a conftest.py file in the root directory of your project
@ -66,44 +65,34 @@ Unsupported idioms / known issues
- no nose-configuration is recognized. - no nose-configuration is recognized.
- ``yield``-based methods are unsupported as of pytest 4.1.0. They are - ``yield``-based methods are
fundamentally incompatible with pytest because they don't support fixtures fundamentally incompatible with pytest because they don't support fixtures
properly since collection and test execution are separated. properly since collection and test execution are separated.
Here is a table comparing the default supported naming conventions for both Here is a table comparing the default supported naming conventions for both
nose and pytest. nose and pytest.
========================== ======== ====== ========= ========================== ======= =====
Convention nose pytest what default naming convention pytest nose
========================== ======== ====== ========= ========================== ======= =====
Ⓜ test*.py module ``test*.py``
Ⓜ test_*.py ✅ ✅ module ``test_*.py`` ✅ ✅
Ⓜ \*_test.py module ``*_test.py``
Ⓜ \*_tests.py module ``*_tests.py``
Ⓒ \*\(unittest.TestCase\) ✅ ✅ class ``*(unittest.TestCase)`` ✅ ✅
ⓜ test_\* ✅ ✅ method ``test_*`` ✅ ✅
Ⓒ Test\* class ``Test*``
ⓜ test_\* method ``test_*``
ⓕ test_\* function ``test_*``
========================== ======== ====== ========= ========================== ======= =====
Symbols are described below
======= =========
Legend
======= =========
Ⓜ module
Ⓒ Class
ⓜ method
ⓕ function
======= =========
Migrating from nose to pytest Migrating from nose to pytest
------------------------------ ------------------------------
`nose2pytest <https://github.com/pytest-dev/nose2pytest>`_ is a Python script `nose2pytest <https://github.com/pytest-dev/nose2pytest>`_ is a Python script
and pytest plugin to help convert Nose-based tests into pytest-based tests. and pytest plugin to help convert Nose-based tests into pytest-based tests.
Specifically, the script transforms nose.tools.assert_* function calls into Specifically, the script transforms ``nose.tools.assert_*`` function calls into
raw assert statements, while preserving format of original arguments raw assert statements, while preserving format of original arguments
as much as possible. as much as possible.