Skip to content

Commit 12c5a58

Browse files
authored
Fix ptest for python-asn1crypto, python-mako, python-gast, and python-nocasedict (#13780)
1 parent 4cee6e0 commit 12c5a58

5 files changed

Lines changed: 65 additions & 14 deletions

File tree

SPECS/python-asn1crypto/python-asn1crypto.spec

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
Summary: A fast, pure Python library for parsing and serializing ASN.1 structures.
22
Name: python-asn1crypto
33
Version: 1.5.1
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: MIT
66
Vendor: Microsoft Corporation
77
Distribution: Azure Linux
88
Group: Development/Languages/Python
99
URL: https://github.com/wbond/asn1crypto
1010
Source0: https://github.com/wbond/asn1crypto/archive/refs/tags/%{version}.tar.gz#/asn1crypto-%{version}.tar.gz
11+
Patch0: remove-import.patch
1112
BuildRequires: python3-devel
1213
BuildRequires: python3-setuptools
1314
%if 0%{?with_check}
1415
BuildRequires: python3-pip
16+
BuildRequires: python3-pytest
1517
%endif
1618
BuildArch: noarch
1719

@@ -26,7 +28,7 @@ Requires: python3
2628
A fast, pure Python library for parsing and serializing ASN.1 structures.
2729

2830
%prep
29-
%autosetup -n asn1crypto-%{version}
31+
%autosetup -p1 -n asn1crypto-%{version}
3032

3133
%build
3234
%py3_build
@@ -35,15 +37,17 @@ A fast, pure Python library for parsing and serializing ASN.1 structures.
3537
%py3_install
3638

3739
%check
38-
pip3 install tox
39-
tox -e py%{python3_version_nodots}
40+
%pytest
4041

4142
%files -n python3-asn1crypto
4243
%defattr(-,root,root,-)
4344
%license LICENSE
4445
%{python3_sitelib}/*
4546

4647
%changelog
48+
* Tue May 13 2025 Riken Maharjan <rmaharjan@microsoft.com> - 1.5.1-2
49+
- Fix Ptest and add a patch to replace imp with importlib.util in test
50+
4751
* Wed Apr 13 2022 Olivia Crain <oliviacrain@microsoft.com> - 1.5.1-1
4852
- Upgrade to latest upstream version
4953
- Add tests using tox-based runner
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff -urN asn1crypto-1.5.1/tests/__init__.py asn1crypto-1.5.1/tests/__init__.py
2+
--- asn1crypto-1.5.1/tests/__init__.py 2022-03-15 14:45:23.000000000 +0000
3+
+++ asn1crypto-1.5.1/tests/__init__.py 2025-05-07 19:00:39.694821504 +0000
4+
@@ -1,8 +1,9 @@
5+
# coding: utf-8
6+
from __future__ import unicode_literals, division, absolute_import, print_function
7+
8+
-import imp
9+
import os
10+
+import sys
11+
+import importlib.util
12+
import unittest
13+
14+
15+
@@ -38,8 +39,19 @@
16+
return None
17+
18+
try:
19+
- mod_info = imp.find_module(mod_dir, [path])
20+
- return imp.load_module(mod, *mod_info)
21+
+ full_mod_path = os.path.join(path, mod_dir, '__init__.py')
22+
+ if not os.path.isfile(full_mod_path):
23+
+ full_mod_path = os.path.join(path, mod_dir + '.py')
24+
+ if not os.path.isfile(full_mod_path):
25+
+ return None
26+
+
27+
+ spec = importlib.util.spec_from_file_location(mod, full_mod_path)
28+
+ if spec is None:
29+
+ return None
30+
+
31+
+ module = importlib.util.module_from_spec(spec)
32+
+ spec.loader.exec_module(module)
33+
+ return module
34+
except ImportError:
35+
return None
36+

SPECS/python-gast/python-gast.spec

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ as produced by ast.parse from the standard ast module.}
66
Summary: Python AST that abstracts the underlying Python version
77
Name: python-gast
88
Version: 0.5.4
9-
Release: 1%{?dist}
9+
Release: 2%{?dist}
1010
License: BSD
1111
Vendor: Microsoft Corporation
1212
Distribution: Azure Linux
@@ -17,6 +17,9 @@ BuildRequires: python3-devel
1717
BuildRequires: python3-packaging
1818
BuildRequires: python3-pip
1919
BuildRequires: python3-wheel
20+
%if 0%{?with_check}
21+
BuildRequires: python3-pytest
22+
%endif
2023
BuildArch: noarch
2124

2225
%description %{_description}
@@ -43,15 +46,16 @@ Summary: %{summary}
4346

4447

4548
%check
46-
pip3 install tox tox-current-env pytest==7.1.3
47-
%tox
48-
49+
%pytest
4950

5051
%files -n python3-gast -f %{pyproject_files}
5152
%license LICENSE
5253
%doc README.rst
5354

5455
%changelog
56+
* Tue May 13 2025 Riken Maharjan <rmaharjan@microsoft.com> - 0.5.4-2
57+
- Fix Ptest by using pytest instead of tox.
58+
5559
* Thu Nov 02 2023 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 0.5.4-1
5660
- Auto-upgrade to 0.5.4 - Azure Linux 3.0 - package upgrades
5761

SPECS/python-mako/python-mako.spec

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Summary: Python templating language
33
Name: python-mako
44
Version: 1.2.4
5-
Release: 1%{?dist}
5+
Release: 2%{?dist}
66
License: MIT
77
Vendor: Microsoft Corporation
88
Distribution: Azure Linux
@@ -13,6 +13,8 @@ BuildArch: noarch
1313

1414
%if 0%{?with_check}
1515
BuildRequires: python3-pip
16+
BuildRequires: python3-pytest
17+
BuildRequires: python3-markupsafe
1618
%endif
1719

1820
%description
@@ -47,8 +49,7 @@ many others, including Django templates, Cheetah, Myghty, and Genshi.
4749
ln -s mako-render %{buildroot}/%{_bindir}/mako-render3
4850

4951
%check
50-
pip3 install tox
51-
tox -e py%{python3_version_nodots}
52+
%pytest
5253

5354
%files -n python3-mako
5455
%defattr(-,root,root,-)
@@ -58,6 +59,9 @@ tox -e py%{python3_version_nodots}
5859
%{_bindir}/mako-render3
5960

6061
%changelog
62+
* Tue May 13 2025 Riken Maharjan <rmaharjan@microsoft.com> - 1.2.4-2
63+
- Fix Ptest by using pytest instead of tox.
64+
6165
* Fri Oct 27 2023 CBL-Mariner Servicing Account <cblmargh@microsoft.com> - 1.2.4-1
6266
- Auto-upgrade to 1.2.4 - Azure Linux 3.0 - package upgrades
6367

SPECS/python-nocasedict/python-nocasedict.spec

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Summary: Case-insensitive ordered dictionary library for Python
44
Name: python-%{pkgname}
55
Version: 2.0.3
6-
Release: 1%{?dist}
6+
Release: 2%{?dist}
77
License: LGPLv2+
88
Vendor: Microsoft Corporation
99
Distribution: Azure Linux
@@ -15,6 +15,7 @@ BuildRequires: python3-six >= %{six_version}
1515
BuildRequires: python3-wheel
1616
%if 0%{?with_check}
1717
BuildRequires: python3-pip
18+
BuildRequires: python3-pytest
1819
%endif
1920
BuildArch: noarch
2021

@@ -40,8 +41,7 @@ rm -rf *.egg-info
4041
%py3_install
4142

4243
%check
43-
pip3 install 'tox>=3.27.1,<4.0.0'
44-
PYTHONPATH=%{buildroot}%{python3_sitelib} tox -e py%{python3_version_nodots}
44+
%pytest
4545

4646
%files -n python3-%{pkgname}
4747
%license LICENSE
@@ -50,6 +50,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} tox -e py%{python3_version_nodots}
5050
%{python3_sitelib}/*.egg-info
5151

5252
%changelog
53+
* Tue May 13 2025 Riken Maharjan <rmaharjan@microsoft.com> - 2.0.3-2
54+
- Fix Ptest by using pytest instead of tox.
55+
5356
* Thu Jul 11 2024 Sam Meluch <sammeluch@microsoft.com> - 2.0.3-1
5457
- Upgrade to 2.0.3
5558

0 commit comments

Comments
 (0)