From 11c6a3ba43836853849c257cc1fbc435641ec0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fukan=20=C3=87a=C4=9Fatay?= Date: Sat, 6 Jun 2026 20:34:35 +0200 Subject: [PATCH 1/3] Replace zeek-btest with pytest for running tests zeek-btest was retired from Fedora due to build failures. All test files in this package use a single `@TEST-EXEC: python3 %INPUT` directive, so a small pytest plugin (conftest.py) that collects test files and runs each as a subprocess is a complete replacement. Addresses #2485942 Drops the btest.cfg source file and the zeek-btest build dependency. --- btest.cfg | 9 --------- conftest.py | 36 ++++++++++++++++++++++++++++++++++++ python-pysubnettree.spec | 10 +++++----- 3 files changed, 41 insertions(+), 14 deletions(-) delete mode 100644 btest.cfg create mode 100644 conftest.py diff --git a/btest.cfg b/btest.cfg deleted file mode 100644 index 7d0611e..0000000 --- a/btest.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[btest] -TestDirs = pysubnettree -TmpDir = %(testbase)s/.tmp -BaselineDir = %(testbase)s/Baseline -IgnoreDirs = .svn CVS .tmp -IgnoreFiles = *.tmp *.swp #* *.trace .DS_Store - -[environment] -TMPDIR=%(testbase)s/.tmp diff --git a/conftest.py b/conftest.py new file mode 100644 index 0000000..78cc5ff --- /dev/null +++ b/conftest.py @@ -0,0 +1,36 @@ +import subprocess +import sys +import pytest + + +def pytest_collect_file(parent, file_path): + if file_path.suffix == ".test": + return BtestFile.from_parent(parent, path=file_path) + + +class BtestFile(pytest.File): + def collect(self): + yield BtestItem.from_parent(self, name=self.path.stem) + + +class BtestItem(pytest.Item): + def runtest(self): + result = subprocess.run( + [sys.executable, str(self.parent.path)], + capture_output=True, + text=True, + ) + if result.returncode != 0: + raise BtestFailure(result) + + def repr_failure(self, excinfo): + exc = excinfo.value + return (exc.result.stdout + exc.result.stderr).strip() + + def reportinfo(self): + return self.parent.path, None, f"btest: {self.name}" + + +class BtestFailure(Exception): + def __init__(self, result): + self.result = result diff --git a/python-pysubnettree.spec b/python-pysubnettree.spec index 2e6c752..f752ee7 100644 --- a/python-pysubnettree.spec +++ b/python-pysubnettree.spec @@ -7,15 +7,15 @@ Summary: Python Module for CIDR Lookups License: BSD-3-Clause-LBNL and BSD-4-Clause URL: https://github.com/zeek/pysubnettree Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz -# btest config file for RPM build environment -Source1: btest.cfg +# pytest plugin to collect and run *.test files without btest +Source1: conftest.py Provides: pysubnettree = %{version}-%{release} Obsoletes: pysubnettree < 0.35-16 BuildRequires: python3-devel BuildRequires: gcc-c++ -BuildRequires: zeek-btest +BuildRequires: python3-pytest %global _description %{expand: @@ -52,9 +52,9 @@ Summary: %{summary} %check %pyproject_check_import +cp %{SOURCE1} testing/conftest.py cd testing -cp %{SOURCE1} btest.cfg -PYTHONPATH="%{buildroot}%{python3_sitearch}:$PWD/Scripts" btest -c btest.cfg -d +PYTHONPATH="%{buildroot}%{python3_sitearch}:$PWD/Scripts" pytest pysubnettree/ %files -n python3-pysubnettree -f %{pyproject_files} From 764a587fedf5ed3c6de01d8427c77f58a2fc3deb Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jul 2026 21:17:08 +0000 Subject: [PATCH 2/3] Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild From aa07f62914d4c5149292b0cac0e40f06247c1f9e Mon Sep 17 00:00:00 2001 From: Python Maint Date: Wed, 22 Jul 2026 10:34:01 +0200 Subject: [PATCH 3/3] Rebuilt for Python 3.15.0b4 ABI change