1- Basic test configuration
2- ===================================
1+ Configuration
2+ =============
33
44Command line options and configuration file settings
55-----------------------------------------------------------------
@@ -15,17 +15,31 @@ which were registered by installed plugins.
1515.. _rootdir :
1616.. _inifiles :
1717
18- initialization : determining rootdir and inifile
18+ Initialization : determining rootdir and inifile
1919-----------------------------------------------
2020
2121.. versionadded :: 2.7
2222
23- pytest determines a " rootdir" for each test run which depends on
23+ pytest determines a `` rootdir `` for each test run which depends on
2424the 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+ ~~~~~~~~~~~~~~~~~~~~~~~
2943
3044Here is the algorithm which finds the rootdir from ``args ``:
3145
0 commit comments