Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/pytest-dev/pytest
/ functions
Functions
4,602 in github.com/pytest-dev/pytest
⨍
Functions
4,602
◇
Types & classes
572
↳
Endpoints
16
↓ 1,091 callers
Method
makepyfile
r"""Shortcut for .makefile() with a .py extension. Defaults to the test name with a '.py' extension, e.g test_foobar.py, overwriting
src/_pytest/pytester.py:852
↓ 844 callers
Method
runpytest
Run pytest inline or in a subprocess, depending on the command line option "--runpytest" and return a :py:class:`~pytest.RunResult`.
src/_pytest/pytester.py:1169
↓ 716 callers
Method
fnmatch_lines
Check lines exist in the output (using :func:`python:fnmatch.fnmatch`). The argument is a list of lines which have to match and can use glob
src/_pytest/pytester.py:1596
↓ 233 callers
Method
inline_run
Run ``pytest.main()`` in-process, returning a HookRecorder. Runs the :py:func:`pytest.main` function to run all of pytest inside the
src/_pytest/pytester.py:1054
↓ 205 callers
Method
append
(self, node: ET.Element)
src/_pytest/junitxml.py:100
↓ 189 callers
Method
makeconftest
Write a contest.py file with 'source' as contents.
src/_pytest/pytester.py:832
↓ 173 callers
Method
assertoutcome
(self, passed: int = 0, skipped: int = 0, failed: int = 0)
src/_pytest/pytester.py:446
↓ 138 callers
Method
mkdir
Create a new (sub)directory.
src/_pytest/pytester.py:905
↓ 106 callers
Method
makeini
Write a tox.ini file with 'source' as contents.
src/_pytest/pytester.py:836
↓ 105 callers
Method
format
(self, record: logging.LogRecord)
src/_pytest/logging.py:104
↓ 89 callers
Method
no_fnmatch_line
Ensure captured lines do not match the given pattern, using ``fnmatch.fnmatch``. :param str pat: The pattern to match lines.
src/_pytest/pytester.py:1699
↓ 80 callers
Method
format
Straightforward replacement of color names to their ASCII codes.
testing/conftest.py:164
↓ 78 callers
Method
get
Get the value for key, or return default if the key wasn't set before.
src/_pytest/stash.py:82
↓ 78 callers
Method
setattr
( self, target: str, name: object, value: Notset = ..., raising: bool
src/_pytest/monkeypatch.py:159
↓ 76 callers
Method
str
Return the entire original text.
src/_pytest/pytester.py:1746
↓ 73 callers
Method
runpytest_subprocess
Run pytest as a subprocess with given arguments. Any plugins added to the :py:attr:`plugins` list will be added using the ``-p`` comm
src/_pytest/pytester.py:1448
↓ 71 callers
Method
assert_outcomes
Assert that the specified outcomes appear with the respective numbers (0 means it didn't occur) in the text output from a test run.
src/_pytest/pytester.py:591
↓ 57 callers
Method
warn
Issue a warning for this Node. Warnings will be displayed after the test session, unless explicitly suppressed. :param Warning warni
src/_pytest/nodes.py:274
↓ 54 callers
Method
setenv
Set environment variable ``name`` to ``value``. If ``prepend`` is a character, read the current environment variable value and prepen
src/_pytest/monkeypatch.py:282
↓ 52 callers
Function
approx
Assert that two numbers (or two sets of numbers) are equal to each other within some tolerance. Due to the :std:doc:`tutorial/floatingpoint`,
src/_pytest/python_api.py:518
↓ 51 callers
Function
run_and_parse
Fixture that returns a function that can be used to execute pytest and return the parsed ``DomNode`` of the root xml node. The ``family`` par
testing/test_junitxml.py:55
↓ 49 callers
Method
parseconfig
Return a new pytest Config instance from given commandline args. This invokes the pytest bootstrapping code in _pytest.config to create
src/_pytest/pytester.py:1192
↓ 45 callers
Method
find_first_by_tag
(self, tag)
testing/test_junitxml.py:85
↓ 42 callers
Function
callequal
(left: Any, right: Any, verbose: int = 0)
testing/test_assertion.py:330
↓ 41 callers
Method
chdir
Cd into the temporary directory. This is done automatically upon instantiation.
src/_pytest/pytester.py:761
↓ 41 callers
Method
getoption
Return command line option value. :param name: Name of the option. You may also specify the literal ``--OPT`` option instead of
src/_pytest/config/__init__.py:1481
↓ 41 callers
Method
pop
Pop the first recorded warning, raise exception if not exists.
src/_pytest/recwarn.py:188
↓ 41 callers
Method
read
(self)
testing/test_pastebin.py:117
↓ 37 callers
Method
delenv
Delete ``name`` from the environment. Raises ``KeyError`` if it does not exist, unless ``raising`` is set to False.
src/_pytest/monkeypatch.py:304
↓ 36 callers
Method
copy_example
Copy file from project's directory into the testdir. :param str name: The name of the file to copy. :return: path to the copied direc
src/_pytest/pytester.py:922
↓ 34 callers
Method
getcalls
Get all recorded calls to hooks with the given names (or name).
src/_pytest/pytester.py:274
↓ 34 callers
Method
getini
Return configuration value from an :ref:`ini file <configfiles>`. If the specified name hasn't been registered through a prior :func:
src/_pytest/config/__init__.py:1369
↓ 34 callers
Method
getitem
Return the test item for a test function. Writes the source to a python file and runs pytest's collection on the resulting module, re
src/_pytest/pytester.py:1225
↓ 34 callers
Method
spawn_pytest
Run pytest using pexpect. This makes sure to use the right pytest and sets up the temporary directory locations. The pexpect
src/_pytest/pytester.py:1474
↓ 33 callers
Method
flush
(child)
testing/test_debugging.py:159
↓ 33 callers
Method
strip
Return new Source object with trailing and leading blank lines removed.
src/_pytest/_code/source.py:72
↓ 32 callers
Method
addoption
Register a command line option. :opts: Option names, can be short or long options. :attrs: Same attributes which the ``add_argument()
src/_pytest/config/argparsing.py:89
↓ 32 callers
Method
syspathinsert
Prepend a directory to sys.path, defaults to :attr:`path`. This is undone automatically when this object dies at the end of each test
src/_pytest/pytester.py:892
↓ 31 callers
Method
assert_attr
(self, **kwargs)
testing/test_junitxml.py:119
↓ 31 callers
Method
getvalue
(self)
src/_pytest/capture.py:173
↓ 31 callers
Method
inline_genitems
Run ``pytest.main(['--collectonly'])`` in-process. Runs the :py:func:`pytest.main` function to run all of pytest inside the test proc
src/_pytest/pytester.py:1043
↓ 30 callers
Method
getreports
( self, names: "Literal['pytest_collectreport']", )
src/_pytest/pytester.py:319
↓ 30 callers
Method
inline_runsource
Run a test module in process using ``pytest.main()``. This run writes "source" into a temporary file and runs ``pytest.main()`` on it
src/_pytest/pytester.py:1029
↓ 30 callers
Method
register
( self, plugin: _PluggyPlugin, name: Optional[str] = None )
src/_pytest/config/__init__.py:447
↓ 29 callers
Method
maketxtfile
r"""Shortcut for .makefile() with a .txt extension. Defaults to the test name with a '.txt' extension, e.g test_foobar.txt, overwriting
src/_pytest/pytester.py:872
↓ 28 callers
Method
getmodulecol
Return the module collection node for ``source``. Writes ``source`` to a file using :py:meth:`makepyfile` and then runs the pytest co
src/_pytest/pytester.py:1256
↓ 27 callers
Method
getrepr
Return str()able representation of this exception info. :param bool showlocals: Show locals per traceback entry. Igno
src/_pytest/_code/code.py:608
↓ 27 callers
Function
import_path
Import and return a module from the given path, which can be a file (a module) or a directory (a package). The import mechanism used is contr
src/_pytest/pathlib.py:454
↓ 27 callers
Function
legacy_path
Internal wrapper to prepare lazy proxies for legacy_path instances
src/_pytest/compat.py:40
↓ 27 callers
Method
makefile
r"""Create new text file(s) in the test directory. :param str ext: The extension the file(s) should use, including the dot, e.g.
src/_pytest/pytester.py:802
↓ 27 callers
Method
mkpydir
Create a new python package. This creates a (sub)directory with an empty ``__init__.py`` file so it gets recognised as a Python packa
src/_pytest/pytester.py:911
↓ 26 callers
Function
fail
Explicitly fail an executing test with the given message. :param reason: The message to show the user as reason for the failure. :pa
src/_pytest/outcomes.py:179
↓ 26 callers
Method
from_current
Return an ExceptionInfo matching the current traceback. .. warning:: Experimental API :param exprinfo: A te
src/_pytest/_code/code.py:496
↓ 26 callers
Function
saferepr
Return a size-limited safe repr-string for the given object. Failing __repr__ functions of user instances will be represented with a short ex
src/_pytest/_io/saferepr.py:97
↓ 25 callers
Function
check_ispytest
(ispytest: bool)
src/_pytest/deprecated.py:153
↓ 25 callers
Method
close
(self)
src/_pytest/capture.py:825
↓ 25 callers
Method
getgroup
Get (or create) a named option Group. :name: Name of the option group. :description: Long description for --help output. :aft
src/_pytest/config/argparsing.py:64
↓ 25 callers
Method
line
(self, msg: str, **kw: bool)
src/_pytest/terminal.py:456
↓ 25 callers
Method
write
(self, s: str)
src/_pytest/capture.py:183
↓ 24 callers
Method
parametrize
Add new invocations to the underlying test function using the list of argvalues for the given argnames. Parametrization is performed d
src/_pytest/python.py:1041
↓ 24 callers
Method
readouterr
(self)
src/_pytest/capture.py:595
↓ 24 callers
Method
undo
Undo previous changes. This call consumes the undo stack. Calling it a second time has no effect unless you do more monkeypatching af
src/_pytest/monkeypatch.py:347
↓ 23 callers
Function
getstatement
(lineno: int, source)
testing/code/test_source.py:399
↓ 23 callers
Method
runpytest_inprocess
Return result of running pytest in-process, providing a similar interface to what self.runpytest() provides.
src/_pytest/pytester.py:1125
↓ 21 callers
Method
Metafunc
(self, func, config=None)
testing/python/metafunc.py:33
↓ 21 callers
Method
parse
(self, args: List[str], addopts: bool = True)
src/_pytest/config/__init__.py:1293
↓ 21 callers
Method
update
( # type: ignore[override] self, other: Union[Mapping[str, Any], Iterable[Tuple[str, Any]]] =
src/_pytest/mark/structures.py:570
↓ 20 callers
Method
listoutcomes
( self, )
src/_pytest/pytester.py:419
↓ 20 callers
Method
setitem
Set dictionary entry ``name`` to value.
src/_pytest/monkeypatch.py:264
↓ 19 callers
Method
countoutcomes
(self)
src/_pytest/pytester.py:443
↓ 19 callers
Method
run
Run a command with arguments. Run a process using :py:class:`subprocess.Popen` saving the stdout and stderr. :param cmdargs:
src/_pytest/pytester.py:1346
↓ 18 callers
Function
getmsg
Rewrite the assertions in f, run it, and get the failure message.
testing/test_assertrewrite.py:44
↓ 18 callers
Method
parseconfigure
Return a new pytest configured Config instance. Returns a new :py:class:`pytest.Config` instance like :py:meth:`parseconfig`, but als
src/_pytest/pytester.py:1215
↓ 18 callers
Method
write
(self, s)
testing/test_capture.py:1444
↓ 17 callers
Function
cls
(order)
doc/en/example/fixtures/test_fixtures_order_scope.py:15
↓ 17 callers
Method
getplugin
(self, name: str)
src/_pytest/config/__init__.py:470
↓ 17 callers
Method
match
Check whether the regular expression `regexp` matches the string representation of the exception using :func:`python:re.search`. If i
src/_pytest/_code/code.py:668
↓ 17 callers
Method
param
( cls, *values: object, marks: Union["MarkDecorator", Collection[Union["MarkDecorator"
src/_pytest/mark/structures.py:86
↓ 17 callers
Method
runitem
Run the "test_func" Item. The calling test instance (class containing the test method) must provide a ``.getrunner()`` method which s
src/_pytest/pytester.py:1014
↓ 16 callers
Method
addini
Register an ini-file option. :name: Name of the ini-variable. :type: Type of the variable. Can be:
src/_pytest/config/argparsing.py:165
↓ 16 callers
Method
find_by_tag
(self, tag)
testing/test_junitxml.py:110
↓ 16 callers
Method
iter_markers
Iterate over all markers of the node. :param name: If given, filter the results by the name attribute.
src/_pytest/nodes.py:360
↓ 16 callers
Method
line
(self, s: str = "", **markup: bool)
src/_pytest/_io/terminalwriter.py:169
↓ 16 callers
Method
re_match_lines
Check lines exist in the output (using :func:`python:re.match`). The argument is a list of lines which have to match using ``re.match``.
src/_pytest/pytester.py:1611
↓ 15 callers
Function
absolutepath
Convert a path to an absolute path using os.path.abspath. Prefer this over Path.resolve() (see #6523). Prefer this over Path.absolute() (not
src/_pytest/pathlib.py:659
↓ 15 callers
Method
count
(self, value: AnyStr)
src/_pytest/capture.py:500
↓ 15 callers
Method
toterminal
(self, tw: TerminalWriter)
testing/code/test_excinfo.py:917
↓ 15 callers
Method
toxml
(self)
testing/test_junitxml.py:123
↓ 14 callers
Function
bestrelpath
Return a string which is a relative path from directory to dest such that directory/bestrelpath == dest. The paths must be either both absolu
src/_pytest/pathlib.py:680
↓ 14 callers
Method
compile
Compile a match expression. :param input: The input expression - one line.
src/_pytest/mark/expression.py:202
↓ 14 callers
Method
getcapture
(self, **kw)
testing/test_capture.py:1067
↓ 14 callers
Function
idmaker
( argnames: Iterable[str], parametersets: Iterable[ParameterSet], idfn: Optional[Callable[[Any], O
src/_pytest/python.py:1428
↓ 13 callers
Method
_to_json
Return the contents of this report as a dict of builtin entries, suitable for serialization. This was originally the serialize_report
src/_pytest/reports.py:205
↓ 13 callers
Method
fspath
The path portion of the reported node, as a string.
src/_pytest/reports.py:162
↓ 13 callers
Method
getini
(self, name)
testing/test_junitxml.py:956
↓ 13 callers
Method
getitems
Return all test items collected from the module. Writes the source to a Python file and runs pytest's collection on the resulting mod
src/_pytest/pytester.py:1247
↓ 13 callers
Method
insert
(self, item, index)
testing/test_assertion.py:687
↓ 13 callers
Method
sep
( self, sepchar: str, title: Optional[str] = None, fullwidth: Optional[int] =
src/_pytest/_io/terminalwriter.py:107
↓ 13 callers
Method
write
(self, msg: str, *, flush: bool = False, **markup: bool)
src/_pytest/_io/terminalwriter.py:144
↓ 13 callers
Method
write_line
(self, line: Union[str, bytes], **markup: bool)
src/_pytest/terminal.py:419
next →
1–100 of 4,602, ranked by callers