fname
stringlengths
63
176
rel_fname
stringclasses
706 values
line
int64
-1
4.5k
name
stringlengths
1
81
kind
stringclasses
2 values
category
stringclasses
2 values
info
stringlengths
0
77.9k
⌀
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,024
sep
ref
function
self._tw.sep("-", secname)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,027
line
ref
function
self._tw.line(content)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,029
summary_stats
def
function
def summary_stats(self) -> None: if self.verbosity < -1: return session_duration = timing.time() - self._sessionstarttime (parts, main_color) = self.build_summary_stats_line() line_parts = [] display_sep = self.verbosity >= 0 if display_sep: ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,034
build_summary_stats_line
ref
function
(parts, main_color) = self.build_summary_stats_line()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,041
markup
ref
function
with_markup = self._tw.markup(text, **markup)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,048
format_session_duration
ref
function
duration = f" in {format_session_duration(session_duration)}"
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,049
markup
ref
function
duration_with_markup = self._tw.markup(duration, **main_markup)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,055
markup
ref
function
markup_for_end_sep = self._tw.markup("", **main_markup)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,062
write_sep
ref
function
self.write_sep("=", msg, fullwidth=fullwidth, **main_markup)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,064
write_line
ref
function
self.write_line(msg, **main_markup)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,066
short_test_summary
def
function
def short_test_summary(self) -> None: if not self.reportchars: return def show_simple(stat, lines: List[str]) -> None: failed = self.stats.get(stat, []) if not failed: return termwidth = self._tw.fullwidth config = self.con...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,070
show_simple
def
function
def show_simple(stat, lines: List[str]) -> None: failed = self.stats.get(stat, []) if not failed: return termwidth = self._tw.fullwidth config = self.config for rep in failed: line = _get_line_with_reprcrash_message(conf...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,077
_get_line_with_reprcrash_message
ref
function
line = _get_line_with_reprcrash_message(config, rep, termwidth)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,080
show_xfailed
def
function
def show_xfailed(lines: List[str]) -> None: xfailed = self.stats.get("xfailed", []) for rep in xfailed: verbose_word = rep._get_verbose_word(self.config) pos = _get_pos(self.config, rep) lines.append(f"{verbose_word} {pos}") ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,083
_get_verbose_word
ref
function
verbose_word = rep._get_verbose_word(self.config)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,084
_get_pos
ref
function
pos = _get_pos(self.config, rep)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,090
show_xpassed
def
function
def show_xpassed(lines: List[str]) -> None: xpassed = self.stats.get("xpassed", []) for rep in xpassed: verbose_word = rep._get_verbose_word(self.config) pos = _get_pos(self.config, rep) reason = rep.wasxfail lines.append(f"...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,093
_get_verbose_word
ref
function
verbose_word = rep._get_verbose_word(self.config)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,094
_get_pos
ref
function
pos = _get_pos(self.config, rep)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,098
show_skipped
def
function
def show_skipped(lines: List[str]) -> None: skipped: List[CollectReport] = self.stats.get("skipped", []) fskips = _folded_skips(self.startpath, skipped) if skipped else [] if not fskips: return verbose_word = skipped[0]._get_verbose_word(self.confi...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,100
_folded_skips
ref
function
fskips = _folded_skips(self.startpath, skipped) if skipped else []
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,103
_get_verbose_word
ref
function
verbose_word = skipped[0]._get_verbose_word(self.config)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,128
action
ref
function
action(lines)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,131
write_sep
ref
function
self.write_sep("=", "short test summary info")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,133
write_line
ref
function
self.write_line(line)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,135
_get_main_color
def
function
def _get_main_color(self) -> Tuple[str, List[str]]: if self._main_color is None or self._known_types is None or self._is_last_item: self._set_main_color() assert self._main_color assert self._known_types return self._main_color, self._known_types def _determi...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,137
_set_main_color
ref
function
self._set_main_color()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,142
_determine_main_color
def
function
def _determine_main_color(self, unknown_type_seen: bool) -> str: stats = self.stats if "failed" in stats or "error" in stats: main_color = "red" elif "warnings" in stats or "xpassed" in stats or unknown_type_seen: main_color = "yellow" elif "passed" in stats o...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,154
_set_main_color
def
function
def _set_main_color(self) -> None: unknown_types: List[str] = [] for found_type in self.stats.keys(): if found_type: # setup/teardown reports have an empty key, ignore them if found_type not in KNOWN_TYPES and found_type not in unknown_types: unknown_...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,161
_determine_main_color
ref
function
self._main_color = self._determine_main_color(bool(unknown_types))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,163
build_summary_stats_line
def
function
def build_summary_stats_line(self) -> Tuple[List[Tuple[str, Dict[str, bool]]], str]: """ Build the parts used in the last summary stats line. The summary stats line is the line shown at the end, "=== 12 passed, 2 errors in Xs===". This function builds a list of the "parts" that mak...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,183
getoption
ref
function
if self.config.getoption("collectonly"):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,184
_build_collect_only_summary_stats_line
ref
function
return self._build_collect_only_summary_stats_line()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,186
_build_normal_summary_stats_line
ref
function
return self._build_normal_summary_stats_line()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,188
_get_reports_to_display
def
function
def _get_reports_to_display(self, key: str) -> List[Any]: """Get test/collection reports for the given status key, such as `passed` or `error`.""" reports = self.stats.get(key, []) return [x for x in reports if getattr(x, "count_towards_summary", _True)] def _build_normal_summary_stats_...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,193
_build_normal_summary_stats_line
def
function
def _build_normal_summary_stats_line( self, ) -> Tuple[List[Tuple[str, Dict[str, bool]]], str]: main_color, known_types = self._get_main_color() parts = [] for key in known_types: reports = self._get_reports_to_display(key) if reports: cou...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,196
_get_main_color
ref
function
main_color, known_types = self._get_main_color()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,200
_get_reports_to_display
ref
function
reports = self._get_reports_to_display(key)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,205
pluralize
ref
function
parts.append(("%d %s" % pluralize(count, key), markup))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,212
_build_collect_only_summary_stats_line
def
function
def _build_collect_only_summary_stats_line( self, ) -> Tuple[List[Tuple[str, Dict[str, bool]]], str]: deselected = len(self._get_reports_to_display("deselected")) errors = len(self._get_reports_to_display("error")) if self._numcollected == 0: parts = [("no tests coll...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,215
_get_reports_to_display
ref
function
deselected = len(self._get_reports_to_display("deselected"))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,216
_get_reports_to_display
ref
function
errors = len(self._get_reports_to_display("error"))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,224
pluralize
ref
function
collected_output = "%d %s collected" % pluralize(self._numcollected, "test")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,240
pluralize
ref
function
parts += [("%d %s" % pluralize(errors, "error"), {main_color: True})]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,245
_get_pos
def
function
def _get_pos(config: Config, rep: BaseReport): nodeid = config.cwd_relative_nodeid(rep.nodeid) return nodeid
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,246
cwd_relative_nodeid
ref
function
nodeid = config.cwd_relative_nodeid(rep.nodeid)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,250
_format_trimmed
def
function
def _format_trimmed(format: str, msg: str, available_width: int) -> Optional[str]: """Format msg into format, ellipsizing it if doesn't fit in available_width. Returns None if even the ellipsis can't fit. """ # Only use the first line. i = msg.find("\n") if i != -1: msg = msg[:i] e...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,261
wcswidth
ref
function
format_width = wcswidth(format.format(""))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,265
wcswidth
ref
function
if format_width + wcswidth(msg) > available_width:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,268
wcswidth
ref
function
while format_width + wcswidth(msg) > available_width:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,275
_get_line_with_reprcrash_message
def
function
def _get_line_with_reprcrash_message( config: Config, rep: BaseReport, termwidth: int
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,279
_get_verbose_word
ref
function
verbose_word = rep._get_verbose_word(config)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,280
_get_pos
ref
function
pos = _get_pos(config, rep)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,283
wcswidth
ref
function
line_width = wcswidth(line)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,292
_format_trimmed
ref
function
msg = _format_trimmed(" - {}", msg, available_width)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,299
_folded_skips
def
function
def _folded_skips( startpath: Path, skipped: Sequence[CollectReport],
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,310
bestrelpath
ref
function
fspath = bestrelpath(startpath, Path(fspath))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,339
pluralize
def
function
def pluralize(count: int, noun: str) -> Tuple[int, str]: # No need to pluralize words such as `failed` or `passed`. if noun not in ["error", "warnings", "test"]: return count, noun # The `warnings` key is plural. To avoid API breakage, we keep it that way but # set it to singular here so we can...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,352
_plugin_nameversions
def
function
def _plugin_nameversions(plugininfo) -> List[str]: values: List[str] = [] for plugin, dist in plugininfo: # Gets us name and version! name = "{dist.project_name}-{dist.version}".format(dist=dist) # Questionable convenience, but it keeps things short. if name.startswith("pytest-")...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,366
format_session_duration
def
function
def format_session_duration(seconds: float) -> str: """Format the given seconds in a human readable manner to show in the final summary.""" if seconds < 60: return f"{seconds:.2f}s" else: dt = datetime.timedelta(seconds=int(seconds)) return f"{seconds:.2f}s ({dt})"
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/terminal.py
src/_pytest/terminal.py
1,375
_get_raw_skip_reason
def
function
def _get_raw_skip_reason(report: TestReport) -> str: """Get the reason string of a skip/xfail/xpass test report. The string is just the part given by the user. """ if hasattr(report, "wasxfail"): reason = cast(str, report.wasxfail) if reason.startswith("reason: "): reason = ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
14
catch_threading_exception
def
class
__init__ _hook __enter__ __exit__
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
39
_hook
def
function
def _hook(self, args: "threading.ExceptHookArgs") -> None: self.args = args def __enter__(self) -> "catch_threading_exception": self._old_hook = threading.excepthook threading.excepthook = self._hook return self def __exit__( self, exc_type: Optional[Type[Ba...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
42
__enter__
def
function
def __enter__(self) -> "catch_threading_exception": self._old_hook = threading.excepthook threading.excepthook = self._hook return self def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[Traceba...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
47
__exit__
def
function
def __exit__( self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType], ) -> None: assert self._old_hook is not None threading.excepthook = self._old_hook self._old_hook = None del self.args ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
59
thread_exception_runtest_hook
def
function
def thread_exception_runtest_hook() -> Generator[None, None, None]: with catch_threading_exception() as cm: yield if cm.args: thread_name = "<unknown>" if cm.args.thread is None else cm.args.thread.name msg = f"Exception in thread {thread_name}\n\n" msg += "".join...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
60
catch_threading_exception
ref
function
with catch_threading_exception() as cm:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
72
PytestUnhandledThreadExceptionWarning
ref
function
warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
75
hookimpl
ref
function
@pytest.hookimpl(hookwrapper=True, trylast=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
76
pytest_runtest_setup
def
function
def pytest_runtest_setup() -> Generator[None, None, None]: yield from thread_exception_runtest_hook()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
77
thread_exception_runtest_hook
ref
function
yield from thread_exception_runtest_hook()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
80
hookimpl
ref
function
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
81
pytest_runtest_call
def
function
def pytest_runtest_call() -> Generator[None, None, None]: yield from thread_exception_runtest_hook()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
82
thread_exception_runtest_hook
ref
function
yield from thread_exception_runtest_hook()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
85
hookimpl
ref
function
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
86
pytest_runtest_teardown
def
function
def pytest_runtest_teardown() -> Generator[None, None, None]: yield from thread_exception_runtest_hook()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/threadexception.py
src/_pytest/threadexception.py
87
thread_exception_runtest_hook
ref
function
yield from thread_exception_runtest_hook()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
24
TempPathFactory
def
class
__init__ from_config _ensure_relative_to_basetemp mktemp getbasetemp
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
42
check_ispytest
ref
function
check_ispytest(_ispytest)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
49
abspath
ref
function
self._given_basetemp = Path(os.path.abspath(str(given_basetemp)))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
54
from_config
def
function
def from_config( cls, config: Config, *, _ispytest: bool = _False, ) -> "TempPathFactory": """Create a factory according to pytest configuration. :meta private: """ check_ispytest(_ispytest) return cls( given_basetemp=config.op...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
64
check_ispytest
ref
function
check_ispytest(_ispytest)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
65
cls
ref
function
return cls(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
71
_ensure_relative_to_basetemp
def
function
def _ensure_relative_to_basetemp(self, basename: str) -> str: basename = os.path.normpath(basename) if (self.getbasetemp() / basename).resolve().parent != self.getbasetemp(): raise ValueError(f"{basename} is not a normalized and relative path") return basename def mktemp(sel...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
72
normpath
ref
function
basename = os.path.normpath(basename)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
73
getbasetemp
ref
function
if (self.getbasetemp() / basename).resolve().parent != self.getbasetemp():
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
73
getbasetemp
ref
function
if (self.getbasetemp() / basename).resolve().parent != self.getbasetemp():
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
92
_ensure_relative_to_basetemp
ref
function
basename = self._ensure_relative_to_basetemp(basename)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
94
getbasetemp
ref
function
p = self.getbasetemp().joinpath(basename)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
97
make_numbered_dir
ref
function
p = make_numbered_dir(root=self.getbasetemp(), prefix=basename, mode=0o700)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
97
getbasetemp
ref
function
p = make_numbered_dir(root=self.getbasetemp(), prefix=basename, mode=0o700)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
98
_trace
ref
function
self._trace("mktemp", p)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
101
getbasetemp
def
function
def getbasetemp(self) -> Path: """Return the base temporary directory, creating it if needed.""" if self._basetemp is not None: return self._basetemp if self._given_basetemp is not None: basetemp = self._given_basetemp if basetemp.exists(): ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
109
rm_rf
ref
function
rm_rf(basetemp)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
115
get_user
ref
function
user = get_user() or "unknown"
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
144
make_numbered_dir_with_cleanup
ref
function
basetemp = make_numbered_dir_with_cleanup(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
153
_trace
ref
function
self._trace("new basetemp", basetemp)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
157
get_user
def
function
def get_user() -> Optional[str]: """Return the current user name, or None if getuser() does not work in the current environment (see #1010).""" import getpass try: return getpass.getuser() except (ImportError, KeyError): return None
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
168
pytest_configure
def
function
def pytest_configure(config: Config) -> None: """Create a TempPathFactory and attach it to the config object. This is to comply with existing plugins which expect the handler to be available at pytest_configure time, but ideally should be moved entirely to the tmp_path_factory session fixture. """ ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/tmpdir.py
src/_pytest/tmpdir.py
175
MonkeyPatch
ref
function
mp = MonkeyPatch()