forked from microsoft/azurelinux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix PTests for Python Packages Initially Missing iniconfig (microsoft…
- Loading branch information
Showing
10 changed files
with
393 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
From 4a87368b71090f1432df6302f178c4babfcec93f Mon Sep 17 00:00:00 2001 | ||
From: Christian Clauss <[email protected]> | ||
Date: Wed, 10 Jan 2024 15:13:40 +0100 | ||
Subject: [PATCH] GitHub Actions: python: ["3.8", "3.9", "3.10", "3.11", | ||
"3.12"] (#575) | ||
|
||
--- | ||
html5lib/tests/tokenizer.py | 4 +++- | ||
html5lib/tests/tree_construction.py | 4 +++- | ||
requirements-test.txt | 3 ++- | ||
3 files changed, 8 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/html5lib/tests/tokenizer.py b/html5lib/tests/tokenizer.py | ||
index cc9897a4..b49d2e6e 100644 | ||
--- a/html5lib/tests/tokenizer.py | ||
+++ b/html5lib/tests/tokenizer.py | ||
@@ -246,7 +246,9 @@ def runtest(self): | ||
def repr_failure(self, excinfo): | ||
traceback = excinfo.traceback | ||
ntraceback = traceback.cut(path=__file__) | ||
- excinfo.traceback = ntraceback.filter() | ||
+ pytest_ver = getattr(pytest, "version_tuple", ()) | ||
+ filter_args = (excinfo,) if pytest_ver >= (7, 4, 0) else () | ||
+ excinfo.traceback = ntraceback.filter(*filter_args) | ||
|
||
return excinfo.getrepr(funcargs=True, | ||
showlocals=False, | ||
diff --git a/html5lib/tests/tree_construction.py b/html5lib/tests/tree_construction.py | ||
index fb0657bf..363b48c2 100644 | ||
--- a/html5lib/tests/tree_construction.py | ||
+++ b/html5lib/tests/tree_construction.py | ||
@@ -135,7 +135,9 @@ def runtest(self): | ||
def repr_failure(self, excinfo): | ||
traceback = excinfo.traceback | ||
ntraceback = traceback.cut(path=__file__) | ||
- excinfo.traceback = ntraceback.filter() | ||
+ pytest_ver = getattr(pytest, "version_tuple", ()) | ||
+ filter_args = (excinfo,) if pytest_ver >= (7, 4, 0) else () | ||
+ excinfo.traceback = ntraceback.filter(*filter_args) | ||
|
||
return excinfo.getrepr(funcargs=True, | ||
showlocals=False, | ||
diff --git a/requirements-test.txt b/requirements-test.txt | ||
index 27866e59..39913ee4 100644 | ||
--- a/requirements-test.txt | ||
+++ b/requirements-test.txt | ||
@@ -3,8 +3,9 @@ | ||
tox>=3.15.1,<4 | ||
flake8>=3.8.1,<3.9 | ||
pytest>=4.6.10,<5 ; python_version < '3' | ||
-pytest>=5.4.2,<7 ; python_version >= '3' | ||
+pytest>=5.4.2,<8 ; python_version >= '3' | ||
coverage>=5.1,<6 | ||
pytest-expect>=1.1.0,<2 | ||
mock>=3.0.5,<4 ; python_version < '3.6' | ||
mock>=4.0.2,<5 ; python_version >= '3.6' | ||
+setuptools; python_version >= '3.12' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
Summary: A python based HTML parser/tokenizer | ||
Name: python-html5lib | ||
Version: 1.1 | ||
Release: 10%{?dist} | ||
Release: 11%{?dist} | ||
License: MIT | ||
Vendor: Microsoft Corporation | ||
Distribution: Azure Linux | ||
URL: https://github.com/html5lib/html5lib-python | ||
Source: %{pypi_source html5lib} | ||
# Fix compatibility with pytest 6 | ||
Patch0: %{url}/pull/506.patch | ||
# fix compatability with python 3.12 | ||
Patch1: ptest-python-3.12-fix.patch | ||
|
||
BuildArch: noarch | ||
|
||
|
@@ -20,6 +22,7 @@ BuildRequires: python3-wheel | |
BuildRequires: python3-atomicwrites | ||
BuildRequires: python3-attrs | ||
BuildRequires: python3-docutils | ||
BuildRequires: python3-more-itertools | ||
BuildRequires: python3-pluggy | ||
BuildRequires: python3-pygments | ||
BuildRequires: python3-pytest | ||
|
@@ -59,14 +62,17 @@ sed -i 's/from mock import/from unittest.mock import/' html5lib/tests/test_meta. | |
%pyproject_save_files html5lib | ||
|
||
%check | ||
pip3 install more-itertools umsgpack webencodings | ||
pip3 install umsgpack webencodings iniconfig | ||
# Disabling broken tests, see: https://github.com/html5lib/html5lib-python/issues/433 | ||
%pytest -k "not test_parser_encoding and not test_prescan_encoding" | ||
|
||
%files -n python3-html5lib -f %{pyproject_files} | ||
%doc CHANGES.rst README.rst | ||
|
||
%changelog | ||
* Mon May 13 2024 Sam Meluch <[email protected]> - 1.1-11 | ||
- Add missing iniconfig dependency to check section | ||
|
||
* Mon Mar 04 2024 Andrew Phelps <[email protected]> - 1.1-10 | ||
- Correct usage of %%pyproject_extras_subpkg macro | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Summary: Library to access the metadata for a Python package | ||
Name: python-importlib-metadata | ||
Version: 6.8.0 | ||
Release: 2%{?dist} | ||
Release: 3%{?dist} | ||
License: ASL 2.0 | ||
Vendor: Microsoft Corporation | ||
Distribution: Azure Linux | ||
|
@@ -60,7 +60,7 @@ Python versions. | |
%pyproject_save_files importlib_metadata | ||
|
||
%check | ||
pip3 install pyfakefs more-itertools | ||
pip3 install pyfakefs more-itertools iniconfig | ||
rm -rf .pyproject-builddir | ||
# Ignored file uses pytest_perf not available in Mariner | ||
# test_find_local tries to install setuptools from PyPI | ||
|
@@ -71,6 +71,9 @@ rm -rf .pyproject-builddir | |
%doc README.rst | ||
|
||
%changelog | ||
* Mon May 13 2024 Sam Meluch <[email protected]> - 6.8.0-3 | ||
- Add missing iniconfig dependency to check section | ||
|
||
* Fri Mar 01 2024 Andrew Phelps <[email protected]> - 6.8.0-2 | ||
- Add BR for python-setuptools_scm | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ use gmpy to speed up high precision operations.} | |
Summary: A pure Python library for multiprecision floating-point arithmetic | ||
Name: python-mpmath | ||
Version: 1.3.0 | ||
Release: 3%{?dist} | ||
Release: 4%{?dist} | ||
License: BSD | ||
Vendor: Microsoft Corporation | ||
Distribution: Azure Linux | ||
|
@@ -73,6 +73,7 @@ sed -i -r 's/use_scm_version=True/version="%{version}"/' setup.py | |
%py3_install | ||
|
||
%check | ||
pip3 install iniconfig | ||
cd build/lib/mpmath/tests/ | ||
xvfb-run -a pytest -v | ||
|
||
|
@@ -83,6 +84,9 @@ xvfb-run -a pytest -v | |
%{python3_sitelib}/mpmath-%{version}-*.egg-info | ||
|
||
%changelog | ||
* Mon May 13 2024 Sam Meluch <[email protected]> - 1.3.0-4 | ||
- Add missing iniconfig dependency to check section | ||
|
||
* Thu Apr 06 2023 Riken Maharjan <[email protected]> - 1.3.0-1 | ||
- Initial CBL-Mariner import from Fedora 38 (license: MIT) | ||
- License Verified | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ The plugin manager stripped of pytest specific details. | |
Summary: The plugin manager stripped of pytest specific details | ||
Name: python-pluggy | ||
Version: 1.3.0 | ||
Release: 1%{?dist} | ||
Release: 2%{?dist} | ||
License: MIT | ||
Vendor: Microsoft Corporation | ||
Distribution: Azure Linux | ||
|
@@ -18,6 +18,7 @@ BuildRequires: python3-setuptools_scm | |
%if 0%{?with_check} | ||
BuildRequires: python3-atomicwrites | ||
BuildRequires: python3-attrs | ||
BuildRequires: python3-more-itertools | ||
BuildRequires: python3-pytest | ||
%endif | ||
|
||
|
@@ -39,7 +40,7 @@ The plugin manager stripped of pytest specific details. | |
%py3_install | ||
|
||
%check | ||
pip3 install more-itertools | ||
pip3 install iniconfig | ||
|
||
# TODO investigate test_load_setuptools_instantiation failure | ||
PYTHONPATH=%{buildroot}%{python3_sitelib} python3 -m pytest testing -k "not test_load_setuptools_instantiation" | ||
|
@@ -51,6 +52,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} python3 -m pytest testing -k "not test | |
%license LICENSE | ||
|
||
%changelog | ||
* Mon May 13 2024 Sam Meluch <[email protected]> - 1.3.0-2 | ||
- Add missing iniconfig dependency to check section | ||
|
||
* Tue Jan 23 2024 Andrew Phelps <[email protected]> - 1.3.0-1 | ||
- Upgrade to version 1.3.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
From 2aa13ad0ce14a716470996bfa18d9976156d3a22 Mon Sep 17 00:00:00 2001 | ||
From: Sam Meluch <[email protected]> | ||
Date: Tue, 14 May 2024 17:03:13 -0700 | ||
Subject: [PATCH] Skip tests for mariner | ||
|
||
--- | ||
tests/test_card.py | 13 +++++++++++++ | ||
tests/test_markdown.py | 13 +++++++++++++ | ||
tests/test_markdown_no_hyperlinks.py | 13 +++++++++++++ | ||
tests/test_syntax.py | 9 ++++++++- | ||
4 files changed, 47 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/tests/test_card.py b/tests/test_card.py | ||
index d578ec89..794fd5b1 100644 | ||
--- a/tests/test_card.py | ||
+++ b/tests/test_card.py | ||
@@ -1,11 +1,23 @@ | ||
import io | ||
import re | ||
+import sys | ||
+import pytest | ||
+ | ||
+from packaging.version import Version | ||
|
||
from rich.__main__ import make_test_card | ||
from rich.console import Console, RenderableType | ||
|
||
from ._card_render import expected | ||
|
||
+if sys.version_info >= (3, 8): | ||
+ from importlib.metadata import Distribution | ||
+else: | ||
+ from importlib_metadata import Distribution | ||
+ | ||
+PYGMENTS_VERSION = Distribution.from_name("pygments").version | ||
+OLD_PYGMENTS = Version(PYGMENTS_VERSION) <= Version("2.13.0") | ||
+ | ||
re_link_ids = re.compile(r"id=[\d\.\-]*?;.*?\x1b") | ||
|
||
|
||
@@ -26,6 +38,7 @@ def render(renderable: RenderableType) -> str: | ||
return output | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_card_render(): | ||
card = make_test_card() | ||
result = render(card) | ||
diff --git a/tests/test_markdown.py b/tests/test_markdown.py | ||
index 710436eb..43a53895 100644 | ||
--- a/tests/test_markdown.py | ||
+++ b/tests/test_markdown.py | ||
@@ -71,10 +71,22 @@ foobar | ||
|
||
import io | ||
import re | ||
+import sys | ||
+import pytest | ||
+ | ||
+from packaging.version import Version | ||
|
||
from rich.console import Console, RenderableType | ||
from rich.markdown import Markdown | ||
|
||
+if sys.version_info >= (3, 8): | ||
+ from importlib.metadata import Distribution | ||
+else: | ||
+ from importlib_metadata import Distribution | ||
+ | ||
+PYGMENTS_VERSION = Distribution.from_name("pygments").version | ||
+OLD_PYGMENTS = Version(PYGMENTS_VERSION) <= Version("2.13.0") | ||
+ | ||
re_link_ids = re.compile(r"id=[\d\.\-]*?;.*?\x1b") | ||
|
||
|
||
@@ -96,6 +108,7 @@ def render(renderable: RenderableType) -> str: | ||
return output | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_markdown_render(): | ||
markdown = Markdown(MARKDOWN) | ||
rendered_markdown = render(markdown) | ||
diff --git a/tests/test_markdown_no_hyperlinks.py b/tests/test_markdown_no_hyperlinks.py | ||
index 4c5ff66f..289806aa 100644 | ||
--- a/tests/test_markdown_no_hyperlinks.py | ||
+++ b/tests/test_markdown_no_hyperlinks.py | ||
@@ -65,10 +65,22 @@ foobar | ||
|
||
import io | ||
import re | ||
+import sys | ||
+import pytest | ||
+ | ||
+from packaging.version import Version | ||
|
||
from rich.console import Console, RenderableType | ||
from rich.markdown import Markdown | ||
|
||
+if sys.version_info >= (3, 8): | ||
+ from importlib.metadata import Distribution | ||
+else: | ||
+ from importlib_metadata import Distribution | ||
+ | ||
+PYGMENTS_VERSION = Distribution.from_name("pygments").version | ||
+OLD_PYGMENTS = Version(PYGMENTS_VERSION) <= Version("2.13.0") | ||
+ | ||
re_link_ids = re.compile(r"id=[\d\.\-]*?;.*?\x1b") | ||
|
||
|
||
@@ -89,6 +101,7 @@ def render(renderable: RenderableType) -> str: | ||
return output | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_markdown_render(): | ||
markdown = Markdown(MARKDOWN, hyperlinks=False) | ||
rendered_markdown = render(markdown) | ||
diff --git a/tests/test_syntax.py b/tests/test_syntax.py | ||
index 37cc293e..cbf9b93a 100644 | ||
--- a/tests/test_syntax.py | ||
+++ b/tests/test_syntax.py | ||
@@ -5,6 +5,7 @@ import tempfile | ||
|
||
import pytest | ||
from pygments.lexers import PythonLexer | ||
+from packaging.version import Version | ||
|
||
from rich.measure import Measurement | ||
from rich.panel import Panel | ||
@@ -26,7 +27,7 @@ else: | ||
from importlib_metadata import Distribution | ||
|
||
PYGMENTS_VERSION = Distribution.from_name("pygments").version | ||
-OLD_PYGMENTS = PYGMENTS_VERSION == "2.13.0" | ||
+OLD_PYGMENTS = Version(PYGMENTS_VERSION) <= Version("2.13.0") | ||
|
||
CODE = '''\ | ||
def loop_first_last(values: Iterable[T]) -> Iterable[Tuple[bool, bool, T]]: | ||
@@ -57,6 +58,7 @@ def test_blank_lines(): | ||
) | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_python_render(): | ||
syntax = Panel.fit( | ||
Syntax( | ||
@@ -76,6 +78,7 @@ def test_python_render(): | ||
assert rendered_syntax == expected | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_python_render_simple(): | ||
syntax = Syntax( | ||
CODE, | ||
@@ -91,6 +94,7 @@ def test_python_render_simple(): | ||
assert rendered_syntax == expected | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_python_render_simple_passing_lexer_instance(): | ||
syntax = Syntax( | ||
CODE, | ||
@@ -141,6 +145,7 @@ def test_python_render_line_range_indent_guides(): | ||
assert rendered_syntax == expected | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_python_render_indent_guides(): | ||
syntax = Panel.fit( | ||
Syntax( | ||
@@ -234,6 +239,7 @@ def test_get_style_for_token(): | ||
assert syntax._get_line_numbers_color() == Color.default() | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_option_no_wrap(): | ||
syntax = Syntax( | ||
CODE, | ||
@@ -251,6 +257,7 @@ def test_option_no_wrap(): | ||
assert rendered_syntax == expected | ||
|
||
|
||
+@pytest.mark.skipif(OLD_PYGMENTS, reason="Pygments changed their tokenizer") | ||
def test_syntax_highlight_ranges(): | ||
syntax = Syntax( | ||
CODE, | ||
-- | ||
2.34.1 | ||
|
Oops, something went wrong.