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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 117 | raises | ref | function | with pytest.raises(ParseError) as excinfo:
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 118 | evaluate | ref | function | evaluate(expr, lambda ident: True)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 123 | parametrize | ref | function | @pytest.mark.parametrize(
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 150 | test_valid_idents | def | function | def test_valid_idents(ident: str) -> None:
assert evaluate(ident, {ident: _True}.__getitem__)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 151 | evaluate | ref | function | assert evaluate(ident, {ident: True}.__getitem__)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 154 | parametrize | ref | function | @pytest.mark.parametrize(
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 178 | test_invalid_idents | def | function | def test_invalid_idents(ident: str) -> None:
with pytest.raises(ParseError):
evaluate(ident, lambda ident: _True)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 179 | raises | ref | function | with pytest.raises(ParseError):
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_mark_expression.py | testing/test_mark_expression.py | 180 | evaluate | ref | function | evaluate(ident, lambda ident: True)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_meta.py | testing/test_meta.py | 23 | parametrize | ref | function | @pytest.mark.parametrize("module", _modules())
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_meta.py | testing/test_meta.py | 23 | _modules | ref | function | @pytest.mark.parametrize("module", _modules())
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 18 | MonkeyPatch | ref | function | yield MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 24 | A | def | class | |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 27 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 28 | raises | ref | function | pytest.raises(AttributeError, monkeypatch.setattr, A, "notexists", 2)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 31 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 34 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 39 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 43 | undo | ref | function | monkeypatch.undo() # double-undo makes no modification
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 46 | raises | ref | function | with pytest.raises(TypeError):
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 53 | abspath | ref | function | assert os.path.abspath("123") == "hello2"
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 55 | test_string_expression_class | def | class | |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 69 | raises | ref | function | with pytest.raises(TypeError):
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 73 | raises | ref | function | with pytest.raises(ImportError):
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 77 | raises | ref | function | with pytest.raises(AttributeError):
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 88 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 93 | A | def | class | |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 96 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 99 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 102 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 104 | raises | ref | function | pytest.raises(AttributeError, monkeypatch.delattr, A, "y")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 108 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 112 | test_setitem | def | function | def test_setitem() -> None:
d = {"x": 1}
monkeypatch = MonkeyPatch()
monkeypatch.setitem(d, "x", 2)
monkeypatch.setitem(d, "y", 1700)
monkeypatch.setitem(d, "y", 1700)
assert d["x"] == 2
assert d["y"] == 1700
monkeypatch.setitem(d, "x", 3)
assert d["x"] == 3
monkeypatch.undo()
... |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 114 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 115 | setitem | ref | function | monkeypatch.setitem(d, "x", 2)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 116 | setitem | ref | function | monkeypatch.setitem(d, "y", 1700)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 117 | setitem | ref | function | monkeypatch.setitem(d, "y", 1700)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 120 | setitem | ref | function | monkeypatch.setitem(d, "x", 3)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 122 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 126 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 130 | test_setitem_deleted_meanwhile | def | function | def test_setitem_deleted_meanwhile() -> None:
d: Dict[str, object] = {}
monkeypatch = MonkeyPatch()
monkeypatch.setitem(d, "x", 2)
del d["x"]
monkeypatch.undo()
assert not d
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 132 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 133 | setitem | ref | function | monkeypatch.setitem(d, "x", 2)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 135 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 139 | parametrize | ref | function | @pytest.mark.parametrize("before", [True, False])
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 140 | test_setenv_deleted_meanwhile | def | function | def test_setenv_deleted_meanwhile(before: bool) -> None:
key = "qwpeoip123"
if before:
os.environ[key] = "world"
monkeypatch = MonkeyPatch()
monkeypatch.setenv(key, "hello")
del os.environ[key]
monkeypatch.undo()
if before:
assert os.environ[key] == "world"
del os.env... |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 144 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 145 | setenv | ref | function | monkeypatch.setenv(key, "hello")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 147 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 155 | test_delitem | def | function | def test_delitem() -> None:
d: Dict[str, object] = {"x": 1}
monkeypatch = MonkeyPatch()
monkeypatch.delitem(d, "x")
assert "x" not in d
monkeypatch.delitem(d, "y", raising=_False)
pytest.raises(KeyError, monkeypatch.delitem, d, "y")
assert not d
monkeypatch.setitem(d, "y", 1700)
asse... |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 157 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 158 | delitem | ref | function | monkeypatch.delitem(d, "x")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 160 | delitem | ref | function | monkeypatch.delitem(d, "y", raising=False)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 161 | raises | ref | function | pytest.raises(KeyError, monkeypatch.delitem, d, "y")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 163 | setitem | ref | function | monkeypatch.setitem(d, "y", 1700)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 166 | setitem | ref | function | monkeypatch.setitem(d, "x", 1500)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 168 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 172 | test_setenv | def | function | def test_setenv() -> None:
monkeypatch = MonkeyPatch()
with pytest.warns(pytest.PytestWarning):
monkeypatch.setenv("XYZ123", 2) # type: ignore[arg-type]
import os
assert os.environ["XYZ123"] == "2"
monkeypatch.undo()
assert "XYZ123" not in os.environ
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 173 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 174 | warns | ref | function | with pytest.warns(pytest.PytestWarning):
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 175 | setenv | ref | function | monkeypatch.setenv("XYZ123", 2) # type: ignore[arg-type]
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 179 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 183 | test_delenv | def | function | def test_delenv() -> None:
name = "xyz1234"
assert name not in os.environ
monkeypatch = MonkeyPatch()
pytest.raises(KeyError, monkeypatch.delenv, name, raising=_True)
monkeypatch.delenv(name, raising=_False)
monkeypatch.undo()
os.environ[name] = "1"
try:
monkeypatch = MonkeyPatch... |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 186 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 187 | raises | ref | function | pytest.raises(KeyError, monkeypatch.delenv, name, raising=True)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 188 | delenv | ref | function | monkeypatch.delenv(name, raising=False)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 189 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 192 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 193 | delenv | ref | function | monkeypatch.delenv(name)
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 195 | setenv | ref | function | monkeypatch.setenv(name, "3")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 197 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 204 | TestEnvironWarnings | def | class | test_setenv_non_str_warning |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 213 | test_setenv_non_str_warning | def | function | def test_setenv_non_str_warning(self, monkeypatch: MonkeyPatch) -> None:
value = 2
msg = (
"Value of environment variable PYTEST_INTERNAL_MY_VAR type should be str, "
"but got 2 (type: int); converted to str implicitly"
)
with pytest.warns(pytest.PytestWarning... |
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 219 | warns | ref | function | with pytest.warns(pytest.PytestWarning, match=re.escape(msg)):
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 220 | setenv | ref | function | monkeypatch.setenv(str(self.VAR_NAME), value) # type: ignore[arg-type]
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 223 | test_setenv_prepend | def | function | def test_setenv_prepend() -> None:
import os
monkeypatch = MonkeyPatch()
monkeypatch.setenv("XYZ123", "2", prepend="-")
monkeypatch.setenv("XYZ123", "3", prepend="-")
assert os.environ["XYZ123"] == "3-2"
monkeypatch.undo()
assert "XYZ123" not in os.environ
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 226 | MonkeyPatch | ref | function | monkeypatch = MonkeyPatch()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 227 | setenv | ref | function | monkeypatch.setenv("XYZ123", "2", prepend="-")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 228 | setenv | ref | function | monkeypatch.setenv("XYZ123", "3", prepend="-")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 230 | undo | ref | function | monkeypatch.undo()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 234 | test_monkeypatch_plugin | def | function | def test_monkeypatch_plugin(pytester: Pytester) -> None:
reprec = pytester.inline_runsource(
"""
def test_method(monkeypatch):
assert monkeypatch.__class__.__name__ == "MonkeyPatch"
"""
)
res = reprec.countoutcomes()
assert tuple(res) == (1, 0, 0), res
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 235 | inline_runsource | ref | function | reprec = pytester.inline_runsource(
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 241 | countoutcomes | ref | function | res = reprec.countoutcomes()
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 245 | test_syspath_prepend | def | function | def test_syspath_prepend(mp: MonkeyPatch) -> None:
old = list(sys.path)
mp.syspath_prepend("world")
mp.syspath_prepend("hello")
assert sys.path[0] == "hello"
assert sys.path[1] == "world"
mp.undo()
assert sys.path == old
mp.undo()
assert sys.path == old
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 247 | syspath_prepend | ref | function | mp.syspath_prepend("world")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 248 | syspath_prepend | ref | function | mp.syspath_prepend("hello")
|
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_monkeypatch.py | testing/test_monkeypatch.py | 251 | undo | ref | function | mp.undo()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.