Name: python-typeguard
Version: 2.13.3
Release: %autorelease
Summary: Run-time type checker for Python
# SPDX
License: MIT
URL: https://github.com/agronholm/typeguard
Source0: %{pypi_source typeguard}
BuildArch: noarch
%global common_description %{expand:
This library provides run-time type checking for functions defined with PEP 484
argument (and return) type annotations.}
%description %{common_description}
%package -n python3-typeguard
Summary: %{summary}
BuildRequires: python3-devel
# pyproject.toml setup_requires
BuildRequires: python3-setuptools
# While pyproject.toml setup_requires has setuptools_scm[toml], this is
# required only when building from GitHub sources and/or via pyproject.toml,
# not when building from the PyPI sdist via setup.py.
# “test” extra:
BuildRequires: python3-pytest
BuildRequires: python3-typing-extensions
# Tests comparing against mypy output are too brittle—tightly coupled to
# particular mypy versions—so we skip them downstream. (Plus, there is no
# python3-mypy in EPEL8.)
%py_provides python3-typeguard
%description -n python3-typeguard %{common_description}
%prep
%autosetup -n typeguard-%{version}
rm -rf typeguard.egg-info
# older setuptools generates PKG-INFO with version=='0.0.0' unless specified
sed -i '/name = typeguard/a version = %{version}' setup.cfg
%build
%py3_build
%install
%py3_install
%check
# The test_cached_module test fails to find a byte-compiled .pyc module where
# it is expecting it. Manually byte-compiling the tests (%%py_byte_compile
# %%{python3} tests) doesn’t help. This is almost certainly specific to the RPM
# build environment and not a real bug.
#
# See also:
# 2.13.3: pytest is failing in three units
# https://github.com/agronholm/typeguard/issues/248
k="${k-}${k+ and }not test_cached_module"
# Tests comparing against mypy output are too brittle—tightly coupled to
# particular mypy versions—so we skip them downstream. (Plus, there is no
# python3-mypy in EPEL8.)
k="${k-}${k+ and }not test_positive"
k="${k-}${k+ and }not test_negative"
%pytest -k "${k-}"
%files -n python3-typeguard
%license LICENSE
%doc README.rst
%{python3_sitelib}/typeguard/
%{python3_sitelib}/typeguard-%{version}-py%{python3_version}.egg-info/
%changelog
%autochangelog