MCPcopy Create free account

hub / github.com/pytest-dev/pytest / functions

Functions4,602 in github.com/pytest-dev/pytest

↓ 1,091 callersMethodmakepyfile
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 callersMethodrunpytest
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 callersMethodfnmatch_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 callersMethodinline_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 callersMethodappend
(self, node: ET.Element)
src/_pytest/junitxml.py:100
↓ 189 callersMethodmakeconftest
Write a contest.py file with 'source' as contents.
src/_pytest/pytester.py:832
↓ 173 callersMethodassertoutcome
(self, passed: int = 0, skipped: int = 0, failed: int = 0)
src/_pytest/pytester.py:446
↓ 138 callersMethodmkdir
Create a new (sub)directory.
src/_pytest/pytester.py:905
↓ 106 callersMethodmakeini
Write a tox.ini file with 'source' as contents.
src/_pytest/pytester.py:836
↓ 105 callersMethodformat
(self, record: logging.LogRecord)
src/_pytest/logging.py:104
↓ 89 callersMethodno_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 callersMethodformat
Straightforward replacement of color names to their ASCII codes.
testing/conftest.py:164
↓ 78 callersMethodget
Get the value for key, or return default if the key wasn't set before.
src/_pytest/stash.py:82
↓ 78 callersMethodsetattr
( self, target: str, name: object, value: Notset = ..., raising: bool
src/_pytest/monkeypatch.py:159
↓ 76 callersMethodstr
Return the entire original text.
src/_pytest/pytester.py:1746
↓ 73 callersMethodrunpytest_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 callersMethodassert_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 callersMethodwarn
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 callersMethodsetenv
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 callersFunctionapprox
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 callersFunctionrun_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 callersMethodparseconfig
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 callersMethodfind_first_by_tag
(self, tag)
testing/test_junitxml.py:85
↓ 42 callersFunctioncallequal
(left: Any, right: Any, verbose: int = 0)
testing/test_assertion.py:330
↓ 41 callersMethodchdir
Cd into the temporary directory. This is done automatically upon instantiation.
src/_pytest/pytester.py:761
↓ 41 callersMethodgetoption
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 callersMethodpop
Pop the first recorded warning, raise exception if not exists.
src/_pytest/recwarn.py:188
↓ 41 callersMethodread
(self)
testing/test_pastebin.py:117
↓ 37 callersMethoddelenv
Delete ``name`` from the environment. Raises ``KeyError`` if it does not exist, unless ``raising`` is set to False.
src/_pytest/monkeypatch.py:304
↓ 36 callersMethodcopy_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 callersMethodgetcalls
Get all recorded calls to hooks with the given names (or name).
src/_pytest/pytester.py:274
↓ 34 callersMethodgetini
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 callersMethodgetitem
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 callersMethodspawn_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 callersMethodflush
(child)
testing/test_debugging.py:159
↓ 33 callersMethodstrip
Return new Source object with trailing and leading blank lines removed.
src/_pytest/_code/source.py:72
↓ 32 callersMethodaddoption
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 callersMethodsyspathinsert
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 callersMethodassert_attr
(self, **kwargs)
testing/test_junitxml.py:119
↓ 31 callersMethodgetvalue
(self)
src/_pytest/capture.py:173
↓ 31 callersMethodinline_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 callersMethodgetreports
( self, names: "Literal['pytest_collectreport']", )
src/_pytest/pytester.py:319
↓ 30 callersMethodinline_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 callersMethodregister
( self, plugin: _PluggyPlugin, name: Optional[str] = None )
src/_pytest/config/__init__.py:447
↓ 29 callersMethodmaketxtfile
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 callersMethodgetmodulecol
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 callersMethodgetrepr
Return str()able representation of this exception info. :param bool showlocals: Show locals per traceback entry. Igno
src/_pytest/_code/code.py:608
↓ 27 callersFunctionimport_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 callersFunctionlegacy_path
Internal wrapper to prepare lazy proxies for legacy_path instances
src/_pytest/compat.py:40
↓ 27 callersMethodmakefile
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 callersMethodmkpydir
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 callersFunctionfail
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 callersMethodfrom_current
Return an ExceptionInfo matching the current traceback. .. warning:: Experimental API :param exprinfo: A te
src/_pytest/_code/code.py:496
↓ 26 callersFunctionsaferepr
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 callersFunctioncheck_ispytest
(ispytest: bool)
src/_pytest/deprecated.py:153
↓ 25 callersMethodclose
(self)
src/_pytest/capture.py:825
↓ 25 callersMethodgetgroup
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 callersMethodline
(self, msg: str, **kw: bool)
src/_pytest/terminal.py:456
↓ 25 callersMethodwrite
(self, s: str)
src/_pytest/capture.py:183
↓ 24 callersMethodparametrize
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 callersMethodreadouterr
(self)
src/_pytest/capture.py:595
↓ 24 callersMethodundo
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 callersFunctiongetstatement
(lineno: int, source)
testing/code/test_source.py:399
↓ 23 callersMethodrunpytest_inprocess
Return result of running pytest in-process, providing a similar interface to what self.runpytest() provides.
src/_pytest/pytester.py:1125
↓ 21 callersMethodMetafunc
(self, func, config=None)
testing/python/metafunc.py:33
↓ 21 callersMethodparse
(self, args: List[str], addopts: bool = True)
src/_pytest/config/__init__.py:1293
↓ 21 callersMethodupdate
( # type: ignore[override] self, other: Union[Mapping[str, Any], Iterable[Tuple[str, Any]]] =
src/_pytest/mark/structures.py:570
↓ 20 callersMethodlistoutcomes
( self, )
src/_pytest/pytester.py:419
↓ 20 callersMethodsetitem
Set dictionary entry ``name`` to value.
src/_pytest/monkeypatch.py:264
↓ 19 callersMethodcountoutcomes
(self)
src/_pytest/pytester.py:443
↓ 19 callersMethodrun
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 callersFunctiongetmsg
Rewrite the assertions in f, run it, and get the failure message.
testing/test_assertrewrite.py:44
↓ 18 callersMethodparseconfigure
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 callersMethodwrite
(self, s)
testing/test_capture.py:1444
↓ 17 callersFunctioncls
(order)
doc/en/example/fixtures/test_fixtures_order_scope.py:15
↓ 17 callersMethodgetplugin
(self, name: str)
src/_pytest/config/__init__.py:470
↓ 17 callersMethodmatch
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 callersMethodparam
( cls, *values: object, marks: Union["MarkDecorator", Collection[Union["MarkDecorator"
src/_pytest/mark/structures.py:86
↓ 17 callersMethodrunitem
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 callersMethodaddini
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 callersMethodfind_by_tag
(self, tag)
testing/test_junitxml.py:110
↓ 16 callersMethoditer_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 callersMethodline
(self, s: str = "", **markup: bool)
src/_pytest/_io/terminalwriter.py:169
↓ 16 callersMethodre_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 callersFunctionabsolutepath
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 callersMethodcount
(self, value: AnyStr)
src/_pytest/capture.py:500
↓ 15 callersMethodtoterminal
(self, tw: TerminalWriter)
testing/code/test_excinfo.py:917
↓ 15 callersMethodtoxml
(self)
testing/test_junitxml.py:123
↓ 14 callersFunctionbestrelpath
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 callersMethodcompile
Compile a match expression. :param input: The input expression - one line.
src/_pytest/mark/expression.py:202
↓ 14 callersMethodgetcapture
(self, **kw)
testing/test_capture.py:1067
↓ 14 callersFunctionidmaker
( argnames: Iterable[str], parametersets: Iterable[ParameterSet], idfn: Optional[Callable[[Any], O
src/_pytest/python.py:1428
↓ 13 callersMethod_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 callersMethodfspath
The path portion of the reported node, as a string.
src/_pytest/reports.py:162
↓ 13 callersMethodgetini
(self, name)
testing/test_junitxml.py:956
↓ 13 callersMethodgetitems
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 callersMethodinsert
(self, item, index)
testing/test_assertion.py:687
↓ 13 callersMethodsep
( self, sepchar: str, title: Optional[str] = None, fullwidth: Optional[int] =
src/_pytest/_io/terminalwriter.py:107
↓ 13 callersMethodwrite
(self, msg: str, *, flush: bool = False, **markup: bool)
src/_pytest/_io/terminalwriter.py:144
↓ 13 callersMethodwrite_line
(self, line: Union[str, bytes], **markup: bool)
src/_pytest/terminal.py:419
next →1–100 of 4,602, ranked by callers