32 lines
1.1 KiB
Diff
32 lines
1.1 KiB
Diff
From b7854561993d00b8dddf3f43ce6b042b4111fa4c Mon Sep 17 00:00:00 2001
|
|
From: jakkdl <h6+github@pm.me>
|
|
Date: Wed, 12 Mar 2025 15:10:29 +0100
|
|
Subject: [PATCH] fix attrs==25.2.0 compatibility
|
|
|
|
---
|
|
changelog/13291.bugfix.rst | 1 +
|
|
src/_pytest/assertion/util.py | 2 +-
|
|
2 files changed, 2 insertions(+), 1 deletion(-)
|
|
create mode 100644 changelog/13291.bugfix.rst
|
|
|
|
diff --git a/changelog/13291.bugfix.rst b/changelog/13291.bugfix.rst
|
|
new file mode 100644
|
|
index 00000000000..03ce06b697a
|
|
--- /dev/null
|
|
+++ b/changelog/13291.bugfix.rst
|
|
@@ -0,0 +1 @@
|
|
+Fixed ``repr`` of ``attrs`` objects in assertion failure messages when using ``attrs>=25.2``.
|
|
diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py
|
|
index 30aee185d57..c545e6cd20c 100644
|
|
--- a/src/_pytest/assertion/util.py
|
|
+++ b/src/_pytest/assertion/util.py
|
|
@@ -169,7 +169,7 @@ def has_default_eq(
|
|
code_filename = obj.__eq__.__code__.co_filename
|
|
|
|
if isattrs(obj):
|
|
- return "attrs generated eq" in code_filename
|
|
+ return "attrs generated " in code_filename
|
|
|
|
return code_filename == "<string>" # data class
|
|
return True
|