Update to v2.16.0 (fedora#2310848)

This commit is contained in:
Roman Inflianskas 2024-10-15 13:22:33 +03:00
parent b4ef8e4038
commit 2d6b7a2a57
No known key found for this signature in database
2 changed files with 30 additions and 14 deletions

View file

@ -1,12 +1,13 @@
From 3ba07652d54b6fe45239c9c9b4ea1e9edac5c976 Mon Sep 17 00:00:00 2001
From 11874096bffd7e935f0191086f7e6403347d0074 Mon Sep 17 00:00:00 2001
From: Roman Inflianskas <rominf@pm.me>
Date: Wed, 2 Oct 2024 14:15:13 +0300
Subject: [PATCH] tests: reorder to unpin pytest
Fix: #3035
Separate forked tests from normal tests within each module during
collection phase to avoid issues, caused by `pytest-forked`.
Rearrange test items so that forked tests come before normal tests
within their respective modules.
Swap the last forked test with the last normal test if necessary.
Workaround to unpin pytest. See:
https://github.com/pytest-dev/pytest/issues/9621,
@ -14,9 +15,9 @@ https://github.com/pytest-dev/pytest-forked/issues/67, and specifically:
https://github.com/pytest-dev/pytest-forked/issues/67#issuecomment-1964718720
---
requirements-devenv.txt | 1 -
tests/conftest.py | 38 ++++++++++++++++++++++++++++++++++++++
tests/conftest.py | 39 +++++++++++++++++++++++++++++++++++++++
tox.ini | 10 ----------
3 files changed, 38 insertions(+), 11 deletions(-)
3 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/requirements-devenv.txt b/requirements-devenv.txt
index 29d3f15e..5696567a 100644
@ -29,10 +30,18 @@ index 29d3f15e..5696567a 100644
-pytest<7.0.0 # https://github.com/pytest-dev/pytest/issues/9621; see tox.ini
pytest-asyncio
diff --git a/tests/conftest.py b/tests/conftest.py
index 64527c1e..bad96e92 100644
index 64527c1e..ade4a6c3 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -645,3 +645,41 @@ class ApproxDict(dict):
@@ -2,6 +2,7 @@ import json
import os
import socket
import warnings
+from collections import OrderedDict
from threading import Thread
from contextlib import contextmanager
from http.server import BaseHTTPRequestHandler, HTTPServer
@@ -645,3 +646,41 @@ class ApproxDict(dict):
def __ne__(self, other):
return not self.__eq__(other)
@ -40,15 +49,15 @@ index 64527c1e..bad96e92 100644
+
+def pytest_collection_modifyitems(config, items):
+ """
+ Rearrange test items so that isolated tests come before normal tests within their respective modules.
+ Swap the last isolated test with the last normal test if necessary.
+ Rearrange test items so that forked tests come before normal tests within their respective modules.
+ Swap the last forked test with the last normal test if necessary.
+
+ Workaround to unpin pytest. See:
+ https://github.com/pytest-dev/pytest/issues/9621,
+ https://github.com/pytest-dev/pytest-forked/issues/67, and specifically:
+ https://github.com/pytest-dev/pytest-forked/issues/67#issuecomment-1964718720
+ """
+ module_states = {}
+ module_states = OrderedDict()
+
+ for idx in range(len(items)):
+ item = items[idx]
@ -75,13 +84,13 @@ index 64527c1e..bad96e92 100644
+ items[last_forked_idx],
+ )
diff --git a/tox.ini b/tox.ini
index 2f351d7e..7af1c7b8 100644
index 8857d1cb..d78f0aaf 100644
--- a/tox.ini
+++ b/tox.ini
@@ -290,19 +290,10 @@ deps =
# === Common ===
py3.8-common: hypothesis
{py3.6,py3.7,py3.8,py3.9,py3.10,py3.11,py3.12,py3.13}-common: pytest-asyncio
common: pytest-asyncio
- # See https://github.com/pytest-dev/pytest/issues/9621
- # and https://github.com/pytest-dev/pytest-forked/issues/67
- # for justification of the upper bound on pytest
@ -107,5 +116,5 @@ index 2f351d7e..7af1c7b8 100644
# Chalice
--
2.46.2
2.47.0

View file

@ -13,6 +13,7 @@
# no_dramatiq: dramatiq is not packaged.
# no_fakeredis: fakeredis is not packaged.
# no_gql: gql is not packaged.
# no_httpcore_http2: httpcore[http2] is not packaged.
# no_huey: huey is not packaged.
# no_huggingface_hub: huggingface_hub is not packaged.
# no_langchain: langchain is not packaged.
@ -44,7 +45,7 @@
%bcond network_tests 0
%global forgeurl https://github.com/getsentry/sentry-python
Version: 2.15.0
Version: 2.16.0
%global tag %{version}
%forgemeta
@ -182,11 +183,13 @@ Summary: %{summary}
# List of names of extras excluded (if not present in components_excluded)
# celery-redbeat: no_celery_redbeat
# clickhouse-driver: no_clickhouse_driver
# http2: no_httpcore_http2
# pyspark: no_pyspark
%global extras_excluded %{shrink:
%{components_excluded}
celery-redbeat
clickhouse-driver
http2
pyspark
%{nil}}
@ -290,6 +293,9 @@ sed -r -i '/(newrelic)/d' tox.ini
sed -r -i '/(mypy-protobuf)/d' tox.ini
sed -r -i '/(types-protobuf)/d' tox.ini
# no_httpcore_http2
sed -r -i '/(httpcore\[http2\])/d' requirements-testing.txt
%generate_buildrequires
%pyproject_buildrequires -x %{extras_csv} -e %{toxenvs_csv}
@ -380,6 +386,7 @@ deselect="${deselect-} --deselect=tests/integrations/django/test_basic.py::test_
deselect="${deselect-} --deselect=tests/integrations/django/test_basic.py::test_cache_spans_disabled_templatetag"
deselect="${deselect-} --deselect=tests/integrations/django/test_basic.py::test_cache_spans_middleware"
deselect="${deselect-} --deselect=tests/integrations/django/test_basic.py::test_cache_spans_templatetag"
deselect="${deselect-} --deselect=tests/integrations/django/test_basic.py::test_ensures_spotlight_middleware_when_spotlight_is_enabled"
deselect="${deselect-} --deselect=tests/integrations/aiohttp/test_aiohttp.py::test_span_origin"
deselect="${deselect-} --deselect=tests/integrations/requests/test_requests.py::test_omit_url_data_if_parsing_fails"
deselect="${deselect-} --deselect=tests/integrations/requests/test_requests.py::test_crumb_capture"