File: coverage-7.7.0.patch

package info (click to toggle)
python-covdefaults 2.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 140 kB
  • sloc: python: 303; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,607 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Steve Kowalik <steven@wedontsleep.org>
Date: Mon, 31 Mar 2025 12:40:43 +1100
Subject: Support Coverage 7.7.0 and above

Coverage 7.7.0 refactored the way the Plugins class is used, and as a
consequence, the load_plugins method was renamed, and is no longer a
class method. Check if the new method exists, and fall back to the older
method otherwise.

[cjwatson: A different patch that drops compatibility with older
versions was committed upstream; see
https://github.com/asottile/covdefaults/pull/164.  However, this one is
more convenient for use in Debian until python-coverage >= 7.7.0
migrates to testing.]

Origin: other, https://github.com/asottile/covdefaults/commit/5f8217506f8425d793b04d6379971c7c6245d9e5
Bug-Debian: https://bugs.debian.org/1107410
Last-Update: 2025-06-10
---
 tests/covdefaults_test.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/covdefaults_test.py b/tests/covdefaults_test.py
index 2bf41c2..9f3f129 100644
--- a/tests/covdefaults_test.py
+++ b/tests/covdefaults_test.py
@@ -228,7 +228,13 @@ def test_configure_keeps_existing_fail_under():
 
 def test_coverage_init():
     cfg = CoverageConfig()
-    plugin_manager = Plugins.load_plugins(['covdefaults'], cfg)
+    # Coverage 7.7.0 and above
+    if hasattr(Plugins, 'load_from_config'):
+        plugin_manager = Plugins()
+        plugin_manager.load_from_config(['covdefaults'], cfg)
+    # Coverage 7.6.12 and below
+    else:  # pragma: no cover
+        plugin_manager = Plugins.load_plugins(['covdefaults'], cfg)
     assert plugin_manager.get('covdefaults.CovDefaults')