@@ -47,8 +47,7 @@ Unsupported idioms / known issues
47
47
- nose imports test modules with the same import path (e.g.
48
48
``tests.test_mode ``) but different file system paths
49
49
(e.g. ``tests/test_mode.py `` and ``other/tests/test_mode.py ``)
50
- by extending sys.path/import semantics. pytest does not do that
51
- but there is discussion in :issue: `268 ` for adding some support. Note that
50
+ by extending sys.path/import semantics. pytest does not do that. Note that
52
51
`nose2 choose to avoid this sys.path/import hackery <https://nose2.readthedocs.io/en/latest/differences.html#test-discovery-and-loading >`_.
53
52
54
53
If you place a conftest.py file in the root directory of your project
@@ -66,44 +65,34 @@ Unsupported idioms / known issues
66
65
67
66
- no nose-configuration is recognized.
68
67
69
- - ``yield ``-based methods are unsupported as of pytest 4.1.0. They are
68
+ - ``yield ``-based methods are
70
69
fundamentally incompatible with pytest because they don't support fixtures
71
70
properly since collection and test execution are separated.
72
71
73
72
Here is a table comparing the default supported naming conventions for both
74
73
nose and pytest.
75
74
76
- ========================== ======== ======
77
- Convention nose pytest
78
- ========================== ======== ======
79
- Ⓜ test*.py ✅
80
- Ⓜ test_*.py ✅ ✅
81
- Ⓜ \* _test.py ✅
82
- Ⓜ \* _tests.py
83
- Ⓒ \*\( unittest.TestCase\) ✅ ✅
84
- ⓜ test _\* ✅ ✅
85
- Ⓒ Test\* ✅
86
- ⓜ test _\* ✅
87
- ⓕ test _\* ✅
88
- ========================== ======== ======
89
-
90
- Symbols are described below
91
-
92
- ======= =========
93
- Legend
94
- ======= =========
95
- Ⓜ module
96
- Ⓒ Class
97
- ⓜ method
98
- ⓕ function
99
- ======= =========
75
+ ========= ========================== ======= =====
76
+ what default naming convention pytest nose
77
+ ========= ========================== ======= =====
78
+ module ``test*.py `` ✅
79
+ module ``test_*.py `` ✅ ✅
80
+ module ``*_test.py `` ✅
81
+ module ``*_tests.py ``
82
+ class ``*(unittest.TestCase) `` ✅ ✅
83
+ method ``test_* `` ✅ ✅
84
+ class ``Test* `` ✅
85
+ method ``test_* `` ✅
86
+ function ``test_* `` ✅
87
+ ========= ========================== ======= =====
88
+
100
89
101
90
Migrating from nose to pytest
102
91
------------------------------
103
92
104
93
`nose2pytest <https://github.com/pytest-dev/nose2pytest >`_ is a Python script
105
94
and pytest plugin to help convert Nose-based tests into pytest-based tests.
106
- Specifically, the script transforms nose.tools.assert_* function calls into
95
+ Specifically, the script transforms `` nose.tools.assert_* `` function calls into
107
96
raw assert statements, while preserving format of original arguments
108
97
as much as possible.
109
98
0 commit comments