__init__.py |
|
354 |
_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).
|
3795 |
_code |
|
|
_io |
|
|
_py |
|
|
_version.py |
|
142 |
assertion |
|
|
cacheprovider.py |
Implementation of the cache provider. |
21952 |
capture.py |
Per-test stdout/stderr capturing mechanism. |
34871 |
compat.py |
Python version compatibility code. |
11467 |
config |
|
|
debugging.py |
Interactive debugging with PDB, the Python Debugger. |
13444 |
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.
|
3111 |
doctest.py |
Discover and run doctests in modules and test files. |
26052 |
faulthandler.py |
Cancel any traceback dumping due to timeout before entering pdb. |
3596 |
fixtures.py |
Return fixturemarker or None if it doesn't exist or raised
exceptions. |
72790 |
freeze_support.py |
Provides a function to report all internal modules for using freezing
tools. |
1310 |
helpconfig.py |
Version info, help messages, tracing configuration. |
8739 |
hookspec.py |
Hook specifications for pytest plugins which are invoked by pytest itself
and by builtin plugins. |
42297 |
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
|
25661 |
legacypath.py |
Add backward compatibility support for the legacy py path type. |
16893 |
logging.py |
Access and control log capturing. |
35381 |
main.py |
Core implementation of the testing process: init, session, runtest loop. |
37548 |
mark |
|
|
monkeypatch.py |
Monkeypatching and mocking functionality. |
14732 |
nodes.py |
Metaclass used by :class:`Node` to enforce that direct construction raises
:class:`Failed`.
This behaviour supports the indirection introduced with :meth:`Node.from_parent`,
the named constructor to be used instead of direct construction. The design
decision to enforce indirection with :class:`NodeMeta` was made as a
temporary aid for refactoring the collection tree, which was diagnosed to
have :class:`Node` objects whose creational patterns were overly entangled.
Once the refactoring is complete, this metaclass can be removed.
See https://github.com/pytest-dev/pytest/projects/3 for an overview of the
progress on detangling the :class:`Node` classes.
|
26706 |
outcomes.py |
Exception classes and constants handling test outcomes as well as
functions creating them. |
10551 |
pastebin.py |
Submit failure or test session information to a pastebin service. |
3977 |
pathlib.py |
Handle known read-only errors during rmtree.
The returned value is used only by our own tests.
|
34194 |
py.typed |
|
0 |
pytester.py |
(Disabled by default) support for testing pytest and pytest plugins.
PYTEST_DONT_REWRITE
|
61982 |
pytester_assertions.py |
Helper plugin for pytester; should not be loaded on its own. |
2328 |
python.py |
Python test discovery, setup and run of test functions. |
65092 |
python_api.py |
Provide shared utilities for making approximate comparisons between
numbers or sequences of numbers. |
39295 |
python_path.py |
|
709 |
recwarn.py |
Record warnings during test function execution. |
13569 |
reports.py |
Read-only property that returns the full string representation of
``longrepr``.
.. versionadded:: 3.0
|
20901 |
runner.py |
Basic collect and runtest protocol implementations. |
19249 |
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.
|
2801 |
setuponly.py |
|
3332 |
setupplan.py |
|
1214 |
skipping.py |
Support for skip/xfail functions and markers. |
10254 |
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.
.. versionadded:: 7.0
|
3109 |
stepwise.py |
|
4714 |
terminal.py |
Terminal reporting of the full testing process.
This is a good source for looking at the various reporting hooks.
|
54970 |
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)
|
3021 |
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.
|
377 |
tmpdir.py |
Support for providing temporary directories to test functions. |
11731 |
unittest.py |
Discover and run std-library "unittest" style tests. |
15508 |
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)
|
3269 |
warning_types.py |
Base class for all warnings emitted by pytest. |
4380 |
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.
|
5256 |