Merge branch 'pytest-dev:main' into patch-1

This commit is contained in:
Tobias Diez
2022-04-22 12:11:03 +02:00
committed by GitHub
18 changed files with 289 additions and 153 deletions

View File

@@ -0,0 +1,12 @@
from dataclasses import dataclass
from dataclasses import InitVar
@dataclass
class Foo:
init_only: InitVar[int]
real_attr: int
def test_demonstrate():
assert Foo(1, 2) == Foo(1, 3)

View File

@@ -1,6 +1,6 @@
anyio[curio,trio]==3.5.0
django==4.0.3
pytest-asyncio==0.18.2
django==4.0.4
pytest-asyncio==0.18.3
pytest-bdd==5.0.0
pytest-cov==3.0.0
pytest-django==4.5.2
@@ -11,5 +11,5 @@ pytest-rerunfailures==10.2
pytest-sugar==0.9.4
pytest-trio==0.7.0
pytest-twisted==1.13.4
twisted==22.2.0
twisted==22.4.0
pytest-xvfb==2.0.0

View File

@@ -882,6 +882,13 @@ class TestAssert_reprcompare_dataclass:
result.assert_outcomes(failed=1, passed=0)
result.stdout.no_re_match_line(".*Differing attributes.*")
def test_data_classes_with_initvar(self, pytester: Pytester) -> None:
p = pytester.copy_example("dataclasses/test_compare_initvar.py")
# issue 9820
result = pytester.runpytest(p, "-vv")
result.assert_outcomes(failed=1, passed=0)
result.stdout.no_re_match_line(".*AttributeError.*")
class TestAssert_reprcompare_attrsclass:
def test_attrs(self) -> None: