1
- Basic test configuration
2
- ===================================
1
+ Configuration
2
+ =============
3
3
4
4
Command line options and configuration file settings
5
5
-----------------------------------------------------------------
@@ -15,17 +15,31 @@ which were registered by installed plugins.
15
15
.. _rootdir :
16
16
.. _inifiles :
17
17
18
- initialization : determining rootdir and inifile
18
+ Initialization : determining rootdir and inifile
19
19
-----------------------------------------------
20
20
21
21
.. versionadded :: 2.7
22
22
23
- pytest determines a " rootdir" for each test run which depends on
23
+ pytest determines a `` rootdir `` for each test run which depends on
24
24
the command line arguments (specified test files, paths) and on
25
- the existence of inifiles. The determined rootdir and ini-file are
26
- printed as part of the pytest header. The rootdir is used for constructing
27
- "nodeids" during collection and may also be used by plugins to store
28
- project/testrun-specific information.
25
+ the existence of *ini-files *. The determined ``rootdir `` and *ini-file * are
26
+ printed as part of the pytest header during startup.
27
+
28
+ Here's a summary what ``pytest `` uses ``rootdir `` for:
29
+
30
+ * Construct *nodeids * during collection; each test is assigned
31
+ a unique *nodeid * which is rooted at the ``rootdir `` and takes in account full path,
32
+ class name, function name and parametrization (if any).
33
+
34
+ * Is used by plugins as a stable location to store project/test run specific information;
35
+ for example, the internal :ref: `cache <cache >` plugin creates a ``.cache `` subdirectory
36
+ in ``rootdir `` to store its cross-test run state.
37
+
38
+ Important to emphasize that ``rootdir `` is **NOT ** used to modify ``sys.path ``/``PYTHONPATH `` or
39
+ influence how modules are imported. See :ref: `pythonpath ` for more details.
40
+
41
+ Finding the ``rootdir ``
42
+ ~~~~~~~~~~~~~~~~~~~~~~~
29
43
30
44
Here is the algorithm which finds the rootdir from ``args ``:
31
45
0 commit comments