summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2022-10-27 14:56:30 +0200
committerSebastian Berg <sebastianb@nvidia.com>2022-10-27 14:56:30 +0200
commit2283052fd01138863a5741d84f358fdbea501bd9 (patch)
treea615d31bc2d6598a7c5265fde677245382a17da7
parent13d55a3c2f016a58a6e9d6b8086f338e07c7478f (diff)
downloadnumpy-2283052fd01138863a5741d84f358fdbea501bd9.tar.gz
DOC: Update TESTS.rst to use the correct names
Not actually sure that setup_module() is what was wanted here, but it works? Mention a bit more about actual pytest fixtures.
-rw-r--r--doc/TESTS.rst17
1 files changed, 10 insertions, 7 deletions
diff --git a/doc/TESTS.rst b/doc/TESTS.rst
index 0d8137f4a..9c5e8571f 100644
--- a/doc/TESTS.rst
+++ b/doc/TESTS.rst
@@ -178,30 +178,33 @@ Similarly for methods::
Easier setup and teardown functions / methods
---------------------------------------------
-Testing looks for module-level or class-level setup and teardown functions by
-name; thus::
+Testing looks for module-level or class method-level setup and teardown
+functions by name; thus::
- def setup():
+ def setup_module():
"""Module-level setup"""
print('doing setup')
- def teardown():
+ def teardown_module():
"""Module-level teardown"""
print('doing teardown')
class TestMe:
- def setup():
+ def setup_method(self):
"""Class-level setup"""
print('doing setup')
- def teardown():
+ def teardown_method():
"""Class-level teardown"""
print('doing teardown')
Setup and teardown functions to functions and methods are known as "fixtures",
-and their use is not encouraged.
+and they should be used sparingly.
+``pytest`` supports more general fixture at various scopes which may be used
+automatically via special arguments. For example, the special argument name
+``tmpdir`` is used in test to create a temporary directory.
Parametric tests
----------------