Update to 0.19 (close RHBZ#2240009)
This commit is contained in:
parent
4f2675c571
commit
b361fc7348
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@
|
||||
/fasteners-0.17.tar.gz
|
||||
/fasteners-0.17.3.tar.gz
|
||||
/fasteners-0.18.tar.gz
|
||||
/fasteners-0.19.tar.gz
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
From 80a3eaed75276faf21034e7e6c626fd19485ea39 Mon Sep 17 00:00:00 2001
|
||||
From: Paulius Sarka <paulius.sarka@gmail.com>
|
||||
Date: Fri, 16 Sep 2022 17:06:59 +0200
|
||||
Subject: [PATCH] Move eventlet tests to main folder and to child process
|
||||
|
||||
---
|
||||
.github/workflows/run_tests.yml | 1 -
|
||||
{tests_eventlet => tests}/test_eventlet.py | 35 +++++++++++++++++-----
|
||||
tests_eventlet/__init__.py | 0
|
||||
3 files changed, 28 insertions(+), 8 deletions(-)
|
||||
rename {tests_eventlet => tests}/test_eventlet.py (54%)
|
||||
delete mode 100644 tests_eventlet/__init__.py
|
||||
|
||||
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml
|
||||
index 85766b0..d4c5d11 100644
|
||||
--- a/.github/workflows/run_tests.yml
|
||||
+++ b/.github/workflows/run_tests.yml
|
||||
@@ -32,4 +32,3 @@ jobs:
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest tests/
|
||||
- pytest tests_eventlet/
|
||||
diff --git a/tests_eventlet/test_eventlet.py b/tests/test_eventlet.py
|
||||
similarity index 54%
|
||||
rename from tests_eventlet/test_eventlet.py
|
||||
rename to tests/test_eventlet.py
|
||||
index 8d0f1f7..cdcc8e8 100644
|
||||
--- a/tests_eventlet/test_eventlet.py
|
||||
+++ b/tests/test_eventlet.py
|
||||
@@ -1,12 +1,17 @@
|
||||
-import eventlet
|
||||
+"""
|
||||
+These tests need to run in child processes, otherwise eventlet monkey_patch
|
||||
+conflicts with multiprocessing and other tests fail.
|
||||
+"""
|
||||
+import concurrent.futures
|
||||
+from multiprocessing import get_context
|
||||
|
||||
-eventlet.monkey_patch(thread=True)
|
||||
|
||||
-from fasteners import ReaderWriterLock
|
||||
-
|
||||
-
|
||||
-def test_eventlet_spawn_n_bug():
|
||||
+def _test_eventlet_spawn_n_bug():
|
||||
"""Both threads run at the same time thru the lock"""
|
||||
+ import eventlet
|
||||
+ eventlet.monkey_patch()
|
||||
+ from fasteners import ReaderWriterLock
|
||||
+
|
||||
STARTED = eventlet.event.Event()
|
||||
FINISHED = eventlet.event.Event()
|
||||
lock = ReaderWriterLock()
|
||||
@@ -22,8 +27,12 @@ def other():
|
||||
assert FINISHED.wait(1) == 'finished'
|
||||
|
||||
|
||||
-def test_eventlet_spawn_n_bugfix():
|
||||
+def _test_eventlet_spawn_n_bugfix():
|
||||
"""Threads wait for each other as they should"""
|
||||
+ import eventlet
|
||||
+ eventlet.monkey_patch()
|
||||
+ from fasteners import ReaderWriterLock
|
||||
+
|
||||
STARTED = eventlet.event.Event()
|
||||
FINISHED = eventlet.event.Event()
|
||||
lock = ReaderWriterLock(current_thread_functor=eventlet.getcurrent)
|
||||
@@ -39,3 +48,15 @@ def other():
|
||||
assert FINISHED.wait(1) is None
|
||||
|
||||
assert FINISHED.wait(1) == 'finished'
|
||||
+
|
||||
+
|
||||
+def test_eventlet_spawn_n_bug():
|
||||
+ with concurrent.futures.ProcessPoolExecutor(mp_context=get_context('spawn')) as executor:
|
||||
+ f = executor.submit(_test_eventlet_spawn_n_bug)
|
||||
+ f.result()
|
||||
+
|
||||
+
|
||||
+def test_eventlet_spawn_n_bugfix():
|
||||
+ with concurrent.futures.ProcessPoolExecutor(mp_context=get_context('spawn')) as executor:
|
||||
+ f = executor.submit(_test_eventlet_spawn_n_bugfix)
|
||||
+ f.result()
|
||||
diff --git a/tests_eventlet/__init__.py b/tests_eventlet/__init__.py
|
||||
deleted file mode 100644
|
||||
index e69de29..0000000
|
||||
@ -1,7 +1,7 @@
|
||||
%bcond tests %{undefined rhel}
|
||||
|
||||
Name: python-fasteners
|
||||
Version: 0.18
|
||||
Version: 0.19
|
||||
Release: %autorelease
|
||||
Summary: A python package that provides useful locks
|
||||
|
||||
@ -10,13 +10,6 @@ URL: https://github.com/harlowja/fasteners
|
||||
# We need to use the GitHub archive instead of the PyPI sdist to get tests.
|
||||
Source: %{url}/archive/%{version}/fasteners-%{version}.tar.gz
|
||||
|
||||
# Backport 80a3eaed75276faf21034e7e6c626fd19485ea39 “Move eventlet tests to
|
||||
# main folder and to child process”. Fixes “Tests hang with eventlet support”
|
||||
# https://github.com/harlowja/fasteners/issues/101. (As an alternative, we
|
||||
# could run pytest on tests/ and tests_eventlet/ in separate invocations.) See
|
||||
# https://github.com/harlowja/fasteners/issues/101#issuecomment-1249462951.
|
||||
Patch: %{url}/commit/80a3eaed75276faf21034e7e6c626fd19485ea39.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
@ -41,7 +34,7 @@ Obsoletes: python-fasteners-doc < 0.18-1
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n fasteners-%{version}
|
||||
%autosetup -n fasteners-%{version}
|
||||
|
||||
|
||||
%generate_buildrequires
|
||||
|
||||
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (fasteners-0.18.tar.gz) = 40928e93fa94ca9e67335d15acede73b70906885f8cc34262b00e2dfba9dfed8647f11490ab0df4c8fcfd94778362cfdc4bd0053063660b962202524dd5bda18
|
||||
SHA512 (fasteners-0.19.tar.gz) = 47db216ff5bad5c669ca2d9be0ee09feba4a3d55ed0eac8d3623bd3d112b0b87fb9019f8785d035ec32ad9fa9e4ae7d1c92a576c97eec29acc82711d7e71a465
|
||||
|
||||
Loading…
Reference in New Issue
Block a user