Sync from SUSE:SLFO:Main python-covdefaults revision 9e854183d6236a56495a450512e0a24f

This commit is contained in:
2025-05-13 19:55:36 +02:00
parent a63c7c78af
commit c969c14369
3 changed files with 50 additions and 6 deletions

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Mar 31 01:59:41 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-coverage-7.7.patch:
* Support Coverage 7.7.0 and above changes with plugins.
- Switch to autosetup and pyproject macros.
- No more greedy globs in %files.
-------------------------------------------------------------------
Sun Jun 11 08:31:24 UTC 2023 - ecsos <ecsos@opensuse.org>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-covdefaults
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -22,10 +22,12 @@ Version: 2.3.0
Release: 0
Summary: Python coverage plugin to provide default settings
License: MIT
Group: Development/Languages/Python
URL: https://github.com/asottile/covdefaults
Source: https://github.com/asottile/covdefaults/archive/v%{version}.tar.gz#/covdefaults-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#asottile/covdefaults#164
Patch0: support-coverage-7.7.patch
BuildRequires: %{python_module coverage}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@@ -38,13 +40,13 @@ BuildArch: noarch
Python coverage plugin to provide default settings.
%prep
%setup -q -n covdefaults-%{version}
%autosetup -p1 -n covdefaults-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@@ -53,6 +55,8 @@ Python coverage plugin to provide default settings.
%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/*
%{python_sitelib}/covdefaults.py
%pycache_only %{python_sitelib}/__pycache__/covdefaults.*.pyc
%{python_sitelib}/covdefaults-%{version}.dist-info
%changelog

View File

@@ -0,0 +1,32 @@
From 5f8217506f8425d793b04d6379971c7c6245d9e5 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Mon, 31 Mar 2025 12:40:43 +1100
Subject: [PATCH] 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.
---
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')