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/testing/test_mark.py
testing/test_mark.py
984
raises
ref
function
with pytest.raises(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
988
get_empty_parameterset_mark
ref
function
get_empty_parameterset_mark(config, ["a"], pytest_configure)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
990
makepyfile
ref
function
p1 = pytester.makepyfile(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
999
runpytest
ref
function
result = pytester.runpytest(str(p1))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,000
fnmatch_lines
ref
function
result.stdout.fnmatch_lines(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,011
test_parameterset_for_parametrize_bad_markname
def
function
def test_parameterset_for_parametrize_bad_markname(pytester: Pytester) -> None: with pytest.raises(pytest.UsageError): test_parameterset_for_parametrize_marks(pytester, "bad")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,012
raises
ref
function
with pytest.raises(pytest.UsageError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,013
test_parameterset_for_parametrize_marks
ref
function
test_parameterset_for_parametrize_marks(pytester, "bad")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,016
test_mark_expressions_no_smear
def
function
def test_mark_expressions_no_smear(pytester: Pytester) -> None: pytester.makepyfile( """ import pytest class BaseTests(object): def test_something(self): pass @pytest.mark.FOO class TestFooClass(BaseTests): pass @pytest.mark....
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,017
makepyfile
ref
function
pytester.makepyfile(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,035
inline_run
ref
function
reprec = pytester.inline_run("-m", "FOO")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,036
countoutcomes
ref
function
passed, skipped, failed = reprec.countoutcomes()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,037
getcalls
ref
function
dlist = reprec.getcalls("pytest_deselected")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,051
test_addmarker_order
def
function
def test_addmarker_order(pytester) -> None: session = mock.Mock() session.own_markers = [] session.parent = None session.nodeid = "" session.path = pytester.path node = Node.from_parent(session, name="Test") node.add_marker("foo") node.add_marker("bar") node.add_marker("baz", append=...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,057
from_parent
ref
function
node = Node.from_parent(session, name="Test")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,058
add_marker
ref
function
node.add_marker("foo")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,059
add_marker
ref
function
node.add_marker("bar")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,060
add_marker
ref
function
node.add_marker("baz", append=False)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,061
iter_markers
ref
function
extracted = [x.name for x in node.iter_markers()]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,065
filterwarnings
ref
function
@pytest.mark.filterwarnings("ignore")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,066
test_markers_from_parametrize
def
function
def test_markers_from_parametrize(pytester: Pytester) -> None: """#3605""" pytester.makepyfile( """ import pytest first_custom_mark = pytest.mark.custom_marker custom_mark = pytest.mark.custom_mark @pytest.fixture(autouse=_True) def trigger(request): ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,068
makepyfile
ref
function
pytester.makepyfile(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,099
runpytest
ref
function
result = pytester.runpytest()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,100
assert_outcomes
ref
function
result.assert_outcomes(passed=4)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,103
test_pytest_param_id_requires_string
def
function
def test_pytest_param_id_requires_string() -> None: with pytest.raises(TypeError) as excinfo: pytest.param(id=_True) # type: ignore[arg-type] (msg,) = excinfo.value.args assert msg == "Expected id to be a string, got <class 'bool'>: _True"
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,104
raises
ref
function
with pytest.raises(TypeError) as excinfo:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,105
param
ref
function
pytest.param(id=True) # type: ignore[arg-type]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,110
parametrize
ref
function
@pytest.mark.parametrize("s", (None, "hello world"))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,111
test_pytest_param_id_allows_none_or_string
def
function
def test_pytest_param_id_allows_none_or_string(s) -> None: assert pytest.param(id=s)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,112
param
ref
function
assert pytest.param(id=s)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,115
parametrize
ref
function
@pytest.mark.parametrize("expr", ("NOT internal_err", "NOT (internal_err)", "bogus="))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,116
test_marker_expr_eval_failure_handling
def
function
def test_marker_expr_eval_failure_handling(pytester: Pytester, expr) -> None: foo = pytester.makepyfile( """ import pytest @pytest.mark.internal_err def test_foo(): pass """ ) expected = f"ERROR: Wrong expression passed to '-m': {expr}: *" result = py...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,117
makepyfile
ref
function
foo = pytester.makepyfile(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,127
runpytest
ref
function
result = pytester.runpytest(foo, "-m", expr)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark.py
testing/test_mark.py
1,128
fnmatch_lines
ref
function
result.stderr.fnmatch_lines([expected])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
7
evaluate
def
function
def evaluate(input: str, matcher: Callable[[str], bool]) -> bool: return Expression.compile(input).evaluate(matcher)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
8
evaluate
ref
function
return Expression.compile(input).evaluate(matcher)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
11
test_empty_is_false
def
function
def test_empty_is_false() -> None: assert not evaluate("", lambda ident: _False) assert not evaluate("", lambda ident: _True) assert not evaluate(" ", lambda ident: _False) assert not evaluate("\t", lambda ident: _False)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
12
evaluate
ref
function
assert not evaluate("", lambda ident: False)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
13
evaluate
ref
function
assert not evaluate("", lambda ident: True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
14
evaluate
ref
function
assert not evaluate(" ", lambda ident: False)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
15
evaluate
ref
function
assert not evaluate("\t", lambda ident: False)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
18
parametrize
ref
function
@pytest.mark.parametrize(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
47
test_basic
def
function
def test_basic(expr: str, expected: bool) -> None: matcher = {"true": _True, "false": _False}.__getitem__ assert evaluate(expr, matcher) is expected
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
49
evaluate
ref
function
assert evaluate(expr, matcher) is expected
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
52
parametrize
ref
function
@pytest.mark.parametrize(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
63
test_syntax_oddeties
def
function
def test_syntax_oddeties(expr: str, expected: bool) -> None: matcher = {"true": _True, "false": _False}.__getitem__ assert evaluate(expr, matcher) is expected
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
65
evaluate
ref
function
assert evaluate(expr, matcher) is expected
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
68
test_backslash_not_treated_specially
def
function
def test_backslash_not_treated_specially() -> None: r"""When generating nodeids, if the source name contains special characters like a newline, they are escaped into two characters like \n. Therefore, a user will never need to insert a literal newline, only \n (two chars). So mark expressions themselves...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
76
evaluate
ref
function
assert evaluate(r"\nfoo\n", matcher)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
77
evaluate
ref
function
assert not evaluate(r"foo", matcher)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
78
raises
ref
function
with pytest.raises(ParseError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
79
evaluate
ref
function
evaluate("\nfoo\n", matcher)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
82
parametrize
ref
function
@pytest.mark.parametrize(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
130
test_syntax_errors
def
function
def test_syntax_errors(expr: str, column: int, message: str) -> None: with pytest.raises(ParseError) as excinfo: evaluate(expr, lambda ident: _True) assert excinfo.value.column == column assert excinfo.value.message == message
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
131
raises
ref
function
with pytest.raises(ParseError) as excinfo:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
132
evaluate
ref
function
evaluate(expr, lambda ident: True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
137
parametrize
ref
function
@pytest.mark.parametrize(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
166
test_valid_idents
def
function
def test_valid_idents(ident: str) -> None: assert evaluate(ident, {ident: _True}.__getitem__)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
167
evaluate
ref
function
assert evaluate(ident, {ident: True}.__getitem__)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
170
parametrize
ref
function
@pytest.mark.parametrize(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
192
test_invalid_idents
def
function
def test_invalid_idents(ident: str) -> None: with pytest.raises(ParseError): evaluate(ident, lambda ident: _True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
193
raises
ref
function
with pytest.raises(ParseError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_mark_expression.py
testing/test_mark_expression.py
194
evaluate
ref
function
evaluate(ident, lambda ident: True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_meta.py
testing/test_meta.py
14
_modules
def
function
def _modules() -> List[str]: pytest_pkg: str = _pytest.__path__ # type: ignore return sorted( n for _, n, _ in pkgutil.walk_packages(pytest_pkg, prefix=_pytest.__name__ + ".") )
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_meta.py
testing/test_meta.py
23
parametrize
ref
function
@pytest.mark.parametrize("module", _modules())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_meta.py
testing/test_meta.py
23
_modules
ref
function
@pytest.mark.parametrize("module", _modules())
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_meta.py
testing/test_meta.py
24
test_no_warnings
def
function
def test_no_warnings(module: str) -> None: # fmt: off subprocess.check_call(( sys.executable, "-W", "error", "-c", f"__import__({module!r})", )) # fmt: on
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
15
mp
def
function
def mp() -> Generator[MonkeyPatch, None, None]: cwd = os.getcwd() sys_path = list(sys.path) yield MonkeyPatch() sys.path[:] = sys_path os.chdir(cwd)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
18
MonkeyPatch
ref
function
yield MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
23
test_setattr
def
function
def test_setattr() -> None: class A: x = 1 monkeypatch = MonkeyPatch() pytest.raises(AttributeError, monkeypatch.setattr, A, "notexists", 2) monkeypatch.setattr(A, "y", 2, raising=_False) assert A.y == 2 # type: ignore monkeypatch.undo() assert not hasattr(A, "y") monkeypatch ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
24
A
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
27
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
28
raises
ref
function
pytest.raises(AttributeError, monkeypatch.setattr, A, "notexists", 2)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
31
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
34
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
39
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
43
undo
ref
function
monkeypatch.undo() # double-undo makes no modification
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
46
raises
ref
function
with pytest.raises(TypeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
50
TestSetattrWithImportPath
def
class
test_string_expression test_string_expression_class test_unicode_string test_wrong_target test_unknown_import test_unknown_attr test_unknown_attr_non_raising test_delattr
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
51
test_string_expression
def
function
def test_string_expression(self, monkeypatch: MonkeyPatch) -> None: monkeypatch.setattr("os.path.abspath", lambda x: "hello2") assert os.path.abspath("123") == "hello2" def test_string_expression_class(self, monkeypatch: MonkeyPatch) -> None: monkeypatch.setattr("_pytest.config.Config",...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
53
abspath
ref
function
assert os.path.abspath("123") == "hello2"
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
55
test_string_expression_class
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
61
test_unicode_string
def
function
def test_unicode_string(self, monkeypatch: MonkeyPatch) -> None: monkeypatch.setattr("_pytest.config.Config", 42) import _pytest assert _pytest.config.Config == 42 # type: ignore monkeypatch.delattr("_pytest.config.Config") def test_wrong_target(self, monkeypatch: MonkeyPatch)...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
68
test_wrong_target
def
function
def test_wrong_target(self, monkeypatch: MonkeyPatch) -> None: with pytest.raises(TypeError): monkeypatch.setattr(None, None) # type: ignore[call-overload] def test_unknown_import(self, monkeypatch: MonkeyPatch) -> None: with pytest.raises(ImportError): monkeypatch.seta...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
69
raises
ref
function
with pytest.raises(TypeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
72
test_unknown_import
def
function
def test_unknown_import(self, monkeypatch: MonkeyPatch) -> None: with pytest.raises(ImportError): monkeypatch.setattr("unkn123.classx", None) def test_unknown_attr(self, monkeypatch: MonkeyPatch) -> None: with pytest.raises(AttributeError): monkeypatch.setattr("os.path.q...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
73
raises
ref
function
with pytest.raises(ImportError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
76
test_unknown_attr
def
function
def test_unknown_attr(self, monkeypatch: MonkeyPatch) -> None: with pytest.raises(AttributeError): monkeypatch.setattr("os.path.qweqwe", None) def test_unknown_attr_non_raising(self, monkeypatch: MonkeyPatch) -> None: # https://github.com/pytest-dev/pytest/issues/746 monkeyp...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
77
raises
ref
function
with pytest.raises(AttributeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
80
test_unknown_attr_non_raising
def
function
def test_unknown_attr_non_raising(self, monkeypatch: MonkeyPatch) -> None: # https://github.com/pytest-dev/pytest/issues/746 monkeypatch.setattr("os.path.qweqwe", 42, raising=_False) assert os.path.qweqwe == 42 # type: ignore def test_delattr(self, monkeypatch: MonkeyPatch) -> None: ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
85
test_delattr
def
function
def test_delattr(self, monkeypatch: MonkeyPatch) -> None: monkeypatch.delattr("os.path.abspath") assert not hasattr(os.path, "abspath") monkeypatch.undo() assert os.path.abspath
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
88
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
92
test_delattr
def
function
def test_delattr() -> None: class A: x = 1 monkeypatch = MonkeyPatch() monkeypatch.delattr(A, "x") assert not hasattr(A, "x") monkeypatch.undo() assert A.x == 1 monkeypatch = MonkeyPatch() monkeypatch.delattr(A, "x") pytest.raises(AttributeError, monkeypatch.delattr, A, "y"...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
93
A
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
96
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
99
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
102
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
104
raises
ref
function
pytest.raises(AttributeError, monkeypatch.delattr, A, "y")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
108
undo
ref
function
monkeypatch.undo()