Name Description Size
__init__.py 356
_argcomplete.py Allow bash-completion for argparse with argcomplete if installed. Needs argcomplete>=0.5.6 for python 3.2/3.3 (older versions fail to find the magic string, so _ARGCOMPLETE env. var is never set, and this does not need special code). Function try_argcomplete(parser) should be called directly before the call to ArgumentParser.parse_args(). The filescompleter is what you normally would use on the positional arguments specification, in order to get "dirname/" after "dirn<TAB>" instead of the default "dirname ": optparser.add_argument(Config._file_or_dir, nargs='*').completer=filescompleter Other, application specific, completers should go in the file doing the add_argument calls as they need to be specified as .completer attributes as well. (If argcomplete is not installed, the function the attribute points to will not be used). SPEEDUP ======= The generic argcomplete script for bash-completion (/etc/bash_completion.d/python-argcomplete.sh) uses a python program to determine startup script generated by pip. You can speed up completion somewhat by changing this script to include # PYTHON_ARGCOMPLETE_OK so the python-argcomplete-check-easy-install-script does not need to be called to find the entry point of the code and see if that is marked with PYTHON_ARGCOMPLETE_OK. INSTALL/DEBUGGING ================= To include this support in another application that has setup.py generated scripts: - Add the line: # PYTHON_ARGCOMPLETE_OK near the top of the main python entry point. - Include in the file calling parse_args(): from _argcomplete import try_argcomplete, filescompleter Call try_argcomplete just before parse_args(), and optionally add filescompleter to the positional arguments' add_argument(). If things do not work right away: - Switch on argcomplete debugging with (also helpful when doing custom completers): export _ARC_DEBUG=1 - Run: python-argcomplete-check-easy-install-script $(which appname) echo $? will echo 0 if the magic line has been found, 1 if not. - Sometimes it helps to find early on errors using: _ARGCOMPLETE=1 _ARC_DEBUG=1 appname which should throw a KeyError: 'COMPLINE' (which is properly set by the global argcomplete script). 3810
_code
_io
_version.py 142
assertion
cacheprovider.py Implementation of the cache provider. 20765
capture.py Per-test stdout/stderr capturing mechanism. 31121
compat.py Python version compatibility code. 12671
config
debugging.py Interactive debugging with PDB, the Python Debugger. 13413
deprecated.py Deprecation messages and bits of code used elsewhere in the codebase that is planned to be removed in the next pytest release. Keeping it in a central location makes it easy to track what is deprecated and should be removed when the time comes. All constants defined in this module should be either instances of :class:`PytestWarning`, or :class:`UnformattedWarning` in case of warnings which need to format their messages. 5464
doctest.py Discover and run doctests in modules and test files. 25476
faulthandler.py Cancel any traceback dumping due to timeout before entering pdb. 3187
fixtures.py 64860
freeze_support.py Provides a function to report all internal modules for using freezing tools. 1339
helpconfig.py Version info, help messages, tracing configuration. 8492
hookspec.py Hook specifications for pytest plugins which are invoked by pytest itself and by builtin plugins. 32523
junitxml.py Report test results in JUnit-XML format, for use with Jenkins and build integration servers. Based on initial code from Ross Lawley. Output conforms to https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd 25594
legacypath.py Add backward compatibility support for the legacy py path type. 16587
logging.py Access and control log capturing. 30227
main.py Core implementation of the testing process: init, session, runtest loop. 32280
mark
monkeypatch.py Monkeypatching and mocking functionality. 12897
nodes.py Return the parent node IDs of a given node ID, inclusive. For the node ID "testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source" the result would be "" "testing" "testing/code" "testing/code/test_excinfo.py" "testing/code/test_excinfo.py::TestFormattedExcinfo" "testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source" Note that / components are only considered until the first ::. 26035
nose.py Run testsuites written for nose. 1370
outcomes.py Exception classes and constants handling test outcomes as well as functions creating them. 10034
pastebin.py Submit failure or test session information to a pastebin service. 3950
pathlib.py Handle known read-only errors during rmtree. The returned value is used only by our own tests. 24118
py.typed 0
pytester.py (Disabled by default) support for testing pytest and pytest plugins. PYTEST_DONT_REWRITE 61109
pytester_assertions.py Helper plugin for pytester; should not be loaded on its own. 2327
python.py Python test discovery, setup and run of test functions. 67157
python_api.py Provide shared utilities for making approximate comparisons between numbers or sequences of numbers. 36652
python_path.py 709
recwarn.py Record warnings during test function execution. 10358
reports.py Read-only property that returns the full string representation of ``longrepr``. .. versionadded:: 3.0 19898
runner.py Basic collect and runtest protocol implementations. 18354
scope.py Scope definition and related utilities. Those are defined here, instead of in the 'fixtures' module because their use is spread across many other pytest modules, and centralizing it in 'fixtures' would cause circular references. Also this makes the module light to import, as it should. 2882
setuponly.py 3263
setupplan.py 1215
skipping.py Support for skip/xfail functions and markers. 10171
stash.py ``StashKey`` is an object used as a key to a :class:`Stash`. A ``StashKey`` is associated with the type ``T`` of the value of the key. A ``StashKey`` is unique and cannot conflict with another key. 3055
stepwise.py 4340
terminal.py Terminal reporting of the full testing process. This is a good source for looking at the various reporting hooks. 50217
threadexception.py Context manager catching threading.Thread exception using threading.excepthook. Storing exc_value using a custom hook can create a reference cycle. The reference cycle is broken explicitly when the context manager exits. Storing thread using a custom hook can resurrect it if it is set to an object which is being finalized. Exiting the context manager clears the stored object. Usage: with threading_helper.catch_threading_exception() as cm: # code spawning a thread which raises an exception ... # check the thread exception: use cm.args ... # cm.args attribute no longer exists at this point # (to break a reference cycle) 2915
timing.py Indirection for time functions. We intentionally grab some "time" functions internally to avoid tests mocking "time" to affect pytest runtime information (issue #185). Fixture "mock_timing" also interacts with this module for pytest's own tests. 375
tmpdir.py Support for providing temporary directories to test functions. 7811
unittest.py Discover and run std-library "unittest" style tests. 14452
unraisableexception.py Context manager catching unraisable exception using sys.unraisablehook. Storing the exception value (cm.unraisable.exc_value) creates a reference cycle. The reference cycle is broken explicitly when the context manager exits. Storing the object (cm.unraisable.object) can resurrect it if it is set to an object which is being finalized. Exiting the context manager clears the stored object. Usage: with catch_unraisable_exception() as cm: # code creating an "unraisable exception" ... # check the unraisable exception: use cm.unraisable ... # cm.unraisable attribute no longer exists at this point # (to break a reference cycle) 3191
warning_types.py Base class for all warnings emitted by pytest. 3458
warnings.py Context manager that catches warnings generated in the contained execution block. ``item`` can be None if we are not in the context of an item execution. Each warning captured triggers the ``pytest_warning_recorded`` hook. 4586