Fix warnings with attrs 19.2 and fix object assertions

attrs 19.2 deprecated cmp in favor of the dataclass-ish eq/order duo.

This causes deprecation warnings that in turn break some of the cool new deep
object comparisons. Since we at attrs expected this to be a problem, it shipped
with helpers to write backward and forward compatible code.

This PR uses that and avoids changed to minimal versions.
This commit is contained in:
Hynek Schlawack
2019-10-01 20:40:13 +02:00
parent 9a4c0b991b
commit a79acf279a
4 changed files with 25 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import pytest
from _pytest import outcomes
from _pytest.assertion import truncate
from _pytest.assertion import util
from _pytest.compat import attrs_no_eq
def mock_config():
@@ -687,7 +688,7 @@ class TestAssert_reprcompare_attrsclass:
@attr.s
class SimpleDataObject:
field_a = attr.ib()
field_b = attr.ib(cmp=False)
field_b = attr.ib(**attrs_no_eq)
left = SimpleDataObject(1, "b")
right = SimpleDataObject(1, "b")