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_assertrewrite.py | testing/test_assertrewrite.py | 648 | getmsg | ref | function | getmsg(f4, must_pass=True)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 650 | f5 | def | function | def f5() -> None:
assert cls == 42 # type: ignore[name-defined] # noqa: F821
class X:
pass
msg = getmsg(f5, {"cls": X})
assert msg is not None
lines = msg.splitlines()
if verbose > 1:
assert lines == [
f"assert {X!r}... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 655 | getmsg | ref | function | getmsg(f5, must_pass=True)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 657 | test_len | def | function | def test_len(self, request) -> None:
def f():
values = list(range(10))
assert len(values) == 11
msg = getmsg(f)
if request.config.getoption("verbose") > 0:
assert msg == "assert 10 == 11\n +10\n -11"
else:
assert msg == "assert 10 ==... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 658 | f | def | function | def f():
assert _False, "something bad!"
assert getmsg(f) == "AssertionError: something bad!\nassert _False"
def test_assertion_message(self, pytester: Pytester) -> None:
pytester.makepyfile(
"""
def test_foo():
assert 1 == 2, "The failur... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 662 | getmsg | ref | function | msg = getmsg(f)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 663 | getoption | ref | function | if request.config.getoption("verbose") > 0:
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 668 | test_custom_reprcompare | def | function | def test_custom_reprcompare(self, monkeypatch) -> None:
def my_reprcompare1(op, left, right) -> str:
return "42"
monkeypatch.setattr(util, "_reprcompare", my_reprcompare1)
def f1() -> None:
assert 42 < 3
assert getmsg(f1) == "assert 42"
def my_repr... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 669 | my_reprcompare1 | def | function | def my_reprcompare1(op, left, right) -> str:
return "42"
monkeypatch.setattr(util, "_reprcompare", my_reprcompare1)
def f1() -> None:
assert 42 < 3
assert getmsg(f1) == "assert 42"
def my_reprcompare2(op, left, right) -> str:
return f"{left... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 674 | f1 | def | function | def f1() -> None:
assert _False
assert getmsg(f1) == "assert _False"
def f2() -> None:
f = _False
assert f
assert getmsg(f2) == "assert _False"
def f3() -> None:
assert a_global # type: ignore[name-defined] # noqa
asse... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 677 | getmsg | ref | function | assert getmsg(f1) == "assert 42"
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 679 | my_reprcompare2 | def | function | def my_reprcompare2(op, left, right) -> str:
return f"{left} {op} {right}"
monkeypatch.setattr(util, "_reprcompare", my_reprcompare2)
def f2() -> None:
assert 1 < 3 < 5 <= 4 < 7
assert getmsg(f2) == "assert 5 <= 4"
def test_assert_raising__bool__in_compari... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 684 | f2 | def | function | def f2() -> None:
f = _False
assert f
assert getmsg(f2) == "assert _False"
def f3() -> None:
assert a_global # type: ignore[name-defined] # noqa
assert getmsg(f3, {"a_global": _False}) == "assert _False"
def f4() -> None:
asser... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 687 | getmsg | ref | function | assert getmsg(f2) == "assert 5 <= 4"
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 689 | test_assert_raising__bool__in_comparison | def | function | def test_assert_raising__bool__in_comparison(self) -> None:
def f() -> None:
class A:
def __bool__(self):
raise ValueError(42)
def __lt__(self, other):
return A()
def __repr__(self):
ret... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 690 | f | def | function | def f() -> None:
assert "1234567890" * 5 + "A" == "1234567890" * 5 + "B"
msg = getmsg(f)
assert msg is not None
line = msg.splitlines()[0]
if request.config.getoption("verbose") > 1:
assert line == (
"assert '123456789012345678901234567890... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 691 | A | def | class | __bool__ __lt__ __repr__ __repr__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 692 | __bool__ | def | function | def __bool__(self):
raise ValueError(42)
def __lt__(self, other):
return A()
def __repr__(self):
return "<MY42 object>"
def myany(x) -> bool:
return _False
assert myany... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 696 | A | ref | function | return A()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 701 | myany | def | function | def myany(x) -> bool:
return _False
assert myany(A() < 0)
msg = getmsg(f)
assert msg is not None
assert "<MY42 object> < 0" in msg
def test_formatchar(self) -> None:
def f() -> None:
assert "%test" == "test" # type: ignore[compa... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 704 | myany | ref | function | assert myany(A() < 0)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 704 | A | ref | function | assert myany(A() < 0)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 706 | getmsg | ref | function | msg = getmsg(f)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 710 | test_formatchar | def | function | def test_formatchar(self) -> None:
def f() -> None:
assert "%test" == "test" # type: ignore[comparison-overlap]
msg = getmsg(f)
assert msg is not None
assert msg.startswith("assert '%test' == 'test'")
def test_custom_repr(self, request) -> None:
def f() -> ... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 711 | f | def | function | def f() -> None:
assert "1234567890" * 5 + "A" == "1234567890" * 5 + "B"
msg = getmsg(f)
assert msg is not None
line = msg.splitlines()[0]
if request.config.getoption("verbose") > 1:
assert line == (
"assert '123456789012345678901234567890... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 714 | getmsg | ref | function | msg = getmsg(f)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 718 | test_custom_repr | def | function | def test_custom_repr(self, request) -> None:
def f() -> None:
class Foo:
a = 1
def __repr__(self):
return "\n{ \n~ \n}"
f = Foo()
assert 0 == f.a
msg = getmsg(f)
assert msg is not None
lines = ... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 719 | f | def | function | def f() -> None:
assert "1234567890" * 5 + "A" == "1234567890" * 5 + "B"
msg = getmsg(f)
assert msg is not None
line = msg.splitlines()[0]
if request.config.getoption("verbose") > 1:
assert line == (
"assert '123456789012345678901234567890... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 720 | Foo | def | class | __repr__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 726 | Foo | ref | function | f = Foo()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 729 | getmsg | ref | function | msg = getmsg(f)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 731 | _format_lines | ref | function | lines = util._format_lines([msg])
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 732 | getoption | ref | function | if request.config.getoption("verbose") > 0:
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 737 | test_custom_repr_non_ascii | def | function | def test_custom_repr_non_ascii(self) -> None:
def f() -> None:
class A:
name = "ä"
def __repr__(self):
return self.name.encode("UTF-8") # only legal in python2
a = A()
assert not a.name
msg = getmsg(f)
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 738 | f | def | function | def f() -> None:
assert "1234567890" * 5 + "A" == "1234567890" * 5 + "B"
msg = getmsg(f)
assert msg is not None
line = msg.splitlines()[0]
if request.config.getoption("verbose") > 1:
assert line == (
"assert '123456789012345678901234567890... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 739 | A | def | class | __bool__ __lt__ __repr__ __repr__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 745 | A | ref | function | a = A()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 748 | getmsg | ref | function | msg = getmsg(f)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 754 | TestRewriteOnImport | def | class | test_pycache_is_a_file test_pycache_is_readonly test_zipfile test_load_resource_via_files_with_rewrite test_readonly test_dont_write_bytecode test_orphaned_pyc_file test_cached_pyc_includes_pytest_version test_pyc_vs_pyo test_package test_translate_newlines test_package_without__init__py test_rewrite_warning test_rewri... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 755 | test_pycache_is_a_file | def | function | def test_pycache_is_a_file(self, pytester: Pytester) -> None:
pytester.path.joinpath("__pycache__").write_text("Hello")
pytester.makepyfile(
"""
def test_rewritten():
assert "@py_builtins" in globals()"""
)
assert pytester.runpytest().ret == 0
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 757 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 762 | runpytest | ref | function | assert pytester.runpytest().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 764 | test_pycache_is_readonly | def | function | def test_pycache_is_readonly(self, pytester: Pytester) -> None:
cache = pytester.mkdir("__pycache__")
old_mode = cache.stat().st_mode
cache.chmod(old_mode ^ stat.S_IWRITE)
pytester.makepyfile(
"""
def test_rewritten():
assert "@py_builtins" in ... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 768 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 774 | runpytest | ref | function | assert pytester.runpytest().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 778 | test_zipfile | def | function | def test_zipfile(self, pytester: Pytester) -> None:
z = pytester.path.joinpath("myzip.zip")
z_fn = str(z)
f = zipfile.ZipFile(z_fn, "w")
try:
f.writestr("test_gum/__init__.py", "")
f.writestr("test_gum/test_lizard.py", "")
finally:
f.close(... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 783 | writestr | ref | function | f.writestr("test_gum/__init__.py", "")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 784 | writestr | ref | function | f.writestr("test_gum/test_lizard.py", "")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 788 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 795 | runpytest | ref | function | assert pytester.runpytest().ret == ExitCode.NO_TESTS_COLLECTED
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 797 | skipif | ref | function | @pytest.mark.skipif(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 801 | test_load_resource_via_files_with_rewrite | def | function | def test_load_resource_via_files_with_rewrite(self, pytester: Pytester) -> None:
example = pytester.path.joinpath("demo") / "example"
init = pytester.path.joinpath("demo") / "__init__.py"
pytester.makepyfile(
**{
"demo/__init__.py": """
from import... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 804 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 824 | runpytest | ref | function | assert pytester.runpytest("-vv").ret == ExitCode.OK
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 826 | test_readonly | def | function | def test_readonly(self, pytester: Pytester) -> None:
sub = pytester.mkdir("testing")
sub.joinpath("test_readonly.py").write_bytes(
b"""
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 837 | runpytest | ref | function | assert pytester.runpytest().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 841 | test_dont_write_bytecode | def | function | def test_dont_write_bytecode(self, pytester: Pytester, monkeypatch) -> None:
monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=_False)
pytester.makepyfile(
"""
import os
def test_no_bytecode():
assert "__pycache__" in __cached__
as... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 842 | delenv | ref | function | monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 844 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 852 | setenv | ref | function | monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 853 | runpytest_subprocess | ref | function | assert pytester.runpytest_subprocess().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 855 | test_orphaned_pyc_file | def | function | def test_orphaned_pyc_file(self, pytester: Pytester, monkeypatch) -> None:
monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=_False)
monkeypatch.setattr(sys, "pycache_prefix", None, raising=_False)
pytester.makepyfile(
"""
import orphan
def test_it():
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 856 | delenv | ref | function | monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 859 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 866 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 882 | runpytest | ref | function | assert pytester.runpytest().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 884 | test_cached_pyc_includes_pytest_version | def | function | def test_cached_pyc_includes_pytest_version(
self, pytester: Pytester, monkeypatch
) -> None:
"""Avoid stale caches (#1671)"""
monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=_False)
monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=_False)
pytester.makepyfile(
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 888 | delenv | ref | function | monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 889 | delenv | ref | function | monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 890 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 896 | runpytest_subprocess | ref | function | result = pytester.runpytest_subprocess()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 903 | skipif | ref | function | @pytest.mark.skipif('"__pypy__" in sys.modules')
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 904 | test_pyc_vs_pyo | def | function | def test_pyc_vs_pyo(self, pytester: Pytester, monkeypatch) -> None:
pytester.makepyfile(
"""
import pytest
def test_optimized():
"hello"
assert test_optimized.__doc__ is None"""
)
p = make_numbered_dir(root=Path(pytester.pat... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 905 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 912 | make_numbered_dir | ref | function | p = make_numbered_dir(root=Path(pytester.path), prefix="runpytest-")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 914 | setenv | ref | function | monkeypatch.setenv("PYTHONOPTIMIZE", "2")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 915 | delenv | ref | function | monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 916 | delenv | ref | function | monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 917 | runpytest_subprocess | ref | function | assert pytester.runpytest_subprocess(tmp).ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 920 | undo | ref | function | monkeypatch.undo()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 921 | delenv | ref | function | monkeypatch.delenv("PYTHONDONTWRITEBYTECODE", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 922 | delenv | ref | function | monkeypatch.delenv("PYTHONPYCACHEPREFIX", raising=False)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 923 | runpytest_subprocess | ref | function | assert pytester.runpytest_subprocess(tmp).ret == 1
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 926 | test_package | def | function | def test_package(self, pytester: Pytester) -> None:
pkg = pytester.path.joinpath("pkg")
pkg.mkdir()
pkg.joinpath("__init__.py")
pkg.joinpath("test_blah.py").write_text(
"""
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 935 | runpytest | ref | function | assert pytester.runpytest().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 937 | test_translate_newlines | def | function | def test_translate_newlines(self, pytester: Pytester) -> None:
content = "def test_rewritten():\r\n assert '@py_builtins' in globals()"
b = content.encode("utf-8")
pytester.path.joinpath("test_newlines.py").write_bytes(b)
assert pytester.runpytest().ret == 0
def test_package_wit... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 941 | runpytest | ref | function | assert pytester.runpytest().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 943 | test_package_without__init__py | def | function | def test_package_without__init__py(self, pytester: Pytester) -> None:
pkg = pytester.mkdir("a_package_without_init_py")
pkg.joinpath("module.py").touch()
pytester.makepyfile("import a_package_without_init_py.module")
assert pytester.runpytest().ret == ExitCode.NO_TESTS_COLLECTED
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 946 | makepyfile | ref | function | pytester.makepyfile("import a_package_without_init_py.module")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 947 | runpytest | ref | function | assert pytester.runpytest().ret == ExitCode.NO_TESTS_COLLECTED
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 949 | test_rewrite_warning | def | function | def test_rewrite_warning(self, pytester: Pytester) -> None:
pytester.makeconftest(
"""
import pytest
pytest.register_assert_rewrite("_pytest")
"""
)
# needs to be a subprocess because pytester explicitly disables this warning
result = pytes... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 950 | makeconftest | ref | function | pytester.makeconftest(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 957 | runpytest_subprocess | ref | function | result = pytester.runpytest_subprocess()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 958 | fnmatch_lines | ref | function | result.stdout.fnmatch_lines(["*Module already imported*: _pytest"])
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 960 | test_rewrite_module_imported_from_conftest | def | function | def test_rewrite_module_imported_from_conftest(self, pytester: Pytester) -> None:
pytester.makeconftest(
"""
import test_rewrite_module_imported
"""
)
pytester.makepyfile(
test_rewrite_module_imported="""
def test_rewritten():
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 961 | makeconftest | ref | function | pytester.makeconftest(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 966 | makepyfile | ref | function | pytester.makepyfile(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 972 | runpytest_subprocess | ref | function | assert pytester.runpytest_subprocess().ret == 0
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 974 | test_remember_rewritten_modules | def | function | def test_remember_rewritten_modules(
self, pytestconfig, pytester: Pytester, monkeypatch
) -> None:
"""`AssertionRewriteHook` should remember rewritten modules so it
doesn't give false positives (#2005)."""
monkeypatch.syspath_prepend(pytester.path)
pytester.makepyfile(te... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_assertrewrite.py | testing/test_assertrewrite.py | 979 | syspath_prepend | ref | function | monkeypatch.syspath_prepend(pytester.path)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.