14
0
Files
python-coverage/python-coverage.spec

157 lines
4.5 KiB
RPMSpec
Raw Normal View History

#
# spec file for package python-coverage
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name: python-coverage%{psuffix}
- update to 7.9.2: * Fix: complex conditionals within a line might cause a KeyError when using sys.monitoring, as reported in issue 1991. This is now fixed. * Fix: we can now measure coverage for code in Python archive (.par) files. Thanks, Itamer Oren. * The "no-ctracer" warning is not issued for Python pre-release versions. Coverage doesn't ship compiled wheels for those versions, so this was far too noisy. * On Python 3.14+, the "sysmon" core is now the default if it's supported for your configuration. Plugins and dynamic contexts are still not supported with it. * Added a [run] core configuration setting to specify the measurement core, which was previously only available through the COVERAGE_CORE environment variable. Finishes issue 1746. * Fixed incorrect rendering of f-strings with doubled braces, closing issue 1980. * If the C tracer core can't be imported, a warning ("no- ctracer") is issued with the reason. * The C tracer core extension module now conforms to PEP 489, closing issue 1977. Thanks, Adam Turner. * Fixed a "ValueError: min() arg is an empty sequence" error caused by strange empty modules, found by oss-fuzz. * Wheels are provided for Windows ARM64 on Python 3.11, 3.12, and 3.13. Thanks, Finn Womack. * A number of EncodingWarnings were fixed that could appear if you've enabled PYTHONWARNDEFAULTENCODING, fixing issue 1966. Thanks, Henry Schreiner. * Fixed a race condition when using sys.monitoring with free- threading Python, closing issue 1970. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-coverage?expand=0&rev=143
2025-07-17 19:36:20 +00:00
Version: 7.9.2
Release: 0
Summary: Code coverage measurement for Python
License: Apache-2.0
URL: https://github.com/nedbat/coveragepy
Source: https://files.pythonhosted.org/packages/source/c/coverage/coverage-%{version}.tar.gz
BuildRequires: %{python_module devel >= 3.9}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python
# coverage[toml]
Recommends: python-tomli
%if %{with libalternatives}
BuildRequires: alts
Requires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
%if %{with test}
# SECTION test requirements
BuildRequires: %{python_module coverage = %{version}}
BuildRequires: %{python_module flaky}
BuildRequires: %{python_module hypothesis >= 6}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module tomli}
# for database (sqlite3) support
BuildRequires: %{pythons}
# /SECTION
%endif
%python_subpackages
%description
Coverage.py measures code coverage, typically during test execution. It uses
the code analysis tools and tracing hooks provided in the Python standard
library to determine which lines are executable, and which have been executed.
%prep
%autosetup -p1 -n coverage-%{version}
# we define everything necessary ourselves below
sed -i -e '/addopts/d' setup.cfg
%build
%if %{without test}
%pyproject_wheel
%endif
%install
%if %{without test}
%pyproject_install
rm -vf %{buildroot}%{_bindir}/coverage{2,3}
%python_clone -a %{buildroot}%{_bindir}/coverage
%python_expand %fdupes %{buildroot}%{$python_sitearch}
%endif
%check
%if %{with test}
export LANG=en_US.UTF8
%python_flavored_alternatives
%{python_expand # indicate a writeable .pth directory for tests
mkdir -p build/mysite
cp %{python_sitearch}/zzzz-import-failed-hooks.pth build/mysite/
}
# the tests need the empty leading part for importing local test projects"
export PYTHONPATH=":$PWD/build/mysite"
export COVERAGE_CORE="pytrace"
%python_exec -mcoverage debug sys
# d:l:p:backports 15.4_py39 does not have python3
if [ ! -x "$(which python3)" ]; then
mypython=$(find %{_bindir} -name 'python3.*[0-9]' -executable -print -quit)
else
mypython=python3
fi
# installs some test modules into tests/ (flavor agnostic)
$mypython igor.py zip_mods
# test_version - checks for non-compiled variant, we ship only compiled one
donttest="test_version"
# test_xdist_sys_path_nuttiness_is_fixed - xdist check that we actually fail on purpose
donttest+=" or test_xdist_sys_path_nuttiness_is_fixed"
# does not find a usable venv
donttest+=" or test_venv"
# writes in /usr/
donttest+=" or test_process"
# requires additional plugins
donttest+=" or test_plugins"
# asserts PYTHONPATH is empty, which it can't be
donttest+=" or test_report_wildcard or test_run_omit_vs_report_omit"
%pytest_arch -n auto --no-flaky-report -k "$donttest" -rp ||:
%pytest_arch -n auto --no-flaky-report -k "not ($donttest)"
%endif
%pre
%python_libalternatives_reset_alternative coverage
%post
%python_install_alternative coverage
%postun
%python_uninstall_alternative coverage
%if %{without test}
%files %{python_files}
%license LICENSE.txt
%doc CHANGES.rst CONTRIBUTORS.txt README.rst howto.txt
%python_alternative %{_bindir}/coverage
%{python_sitearch}/coverage/
%{python_sitearch}/coverage-%{version}.dist-info
%endif
%changelog