Update to 0.18 (close RHBZ#2126965)
- The separate -doc subpackage is dropped since upstream switched from sphinx to mkdocs
This commit is contained in:
parent
0b6bf6501c
commit
459a7e4c16
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
||||
/fasteners-0.14.1.tar.gz
|
||||
/fasteners-0.17.tar.gz
|
||||
/fasteners-0.17.3.tar.gz
|
||||
/fasteners-0.18.tar.gz
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
From 49d8f5bb56157a82ff3e6128b506638a214e6d43 Mon Sep 17 00:00:00 2001
|
||||
From: Paulius Sarka <paulius.sarka@gmail.com>
|
||||
Date: Tue, 8 Feb 2022 18:46:36 +0100
|
||||
Subject: [PATCH] Remove futures from the requirements-test.txt
|
||||
|
||||
---
|
||||
requirements-test.txt | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/requirements-test.txt b/requirements-test.txt
|
||||
index 38cd410..0f40737 100644
|
||||
--- a/requirements-test.txt
|
||||
+++ b/requirements-test.txt
|
||||
@@ -1,4 +1,3 @@
|
||||
diskcache
|
||||
more_itertools
|
||||
-futures
|
||||
pytest
|
||||
86
80a3eaed75276faf21034e7e6c626fd19485ea39.patch
Normal file
86
80a3eaed75276faf21034e7e6c626fd19485ea39.patch
Normal file
@ -0,0 +1,86 @@
|
||||
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,16 +1,10 @@
|
||||
%bcond_without tests
|
||||
|
||||
# Sphinx-generated HTML documentation is not suitable for packaging; see
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
|
||||
#
|
||||
# We can generate PDF documentation as a substitute.
|
||||
%bcond_without doc_pdf
|
||||
|
||||
# The python-diskcache package, used in some of the tests, has been retired.
|
||||
%bcond_with diskcache
|
||||
|
||||
Name: python-fasteners
|
||||
Version: 0.17.3
|
||||
Version: 0.18
|
||||
Release: %autorelease
|
||||
Summary: A python package that provides useful locks
|
||||
|
||||
@ -19,22 +13,17 @@ URL: https://github.com/harlowja/fasteners
|
||||
# We need to use the GitHub archive instead of the PyPI sdist to get tests.
|
||||
Source0: %{url}/archive/%{version}/fasteners-%{version}.tar.gz
|
||||
|
||||
# “Remove futures from the requirements-test.txt”
|
||||
# Backport upstream commit 49d8f5b to remove a test dependency that is no
|
||||
# longer used and only supports Python 2.
|
||||
Patch: %{url}/commit/49d8f5bb56157a82ff3e6128b506638a214e6d43.patch
|
||||
# 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
|
||||
|
||||
%if %{with doc_pdf}
|
||||
BuildRequires: make
|
||||
BuildRequires: python3dist(sphinx)
|
||||
BuildRequires: python3-sphinx-latex
|
||||
BuildRequires: latexmk
|
||||
%endif
|
||||
|
||||
%global common_description %{expand:
|
||||
Cross platform locks for threads and processes}
|
||||
|
||||
@ -44,15 +33,16 @@ Cross platform locks for threads and processes}
|
||||
%package -n python3-fasteners
|
||||
Summary: A python package that provides useful locks
|
||||
|
||||
# The mkdocs-generated HTML documentation is not suitable for packaging; see
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
|
||||
#
|
||||
# The Provides/Obsoletes can be removed after F38 reaches end-of-life.
|
||||
Provides: python-fasteners-doc = %{version}-%{release}
|
||||
Obsoletes: python-fasteners-doc < 0.18-1
|
||||
|
||||
%description -n python3-fasteners %{common_description}
|
||||
|
||||
|
||||
%package doc
|
||||
Summary: Documentation for fasteners
|
||||
|
||||
%description doc %{common_description}
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n fasteners-%{version}
|
||||
%if %{without diskcache}
|
||||
@ -67,12 +57,6 @@ sed -r -i '/\b(diskcache)\b/d' requirements-test.txt
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
%if %{with doc_pdf}
|
||||
PYTHONPATH="${PWD}" \
|
||||
sphinx-build -b latex %{?_smp_mflags} doc/source %{_vpath_builddir}/_latex
|
||||
%make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet'
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
@ -81,7 +65,7 @@ PYTHONPATH="${PWD}" \
|
||||
|
||||
%check
|
||||
%if %{with tests}
|
||||
%pytest %{?!with_diskcache:--ignore=tests/test_reader_writer_lock.py}
|
||||
%pytest %{?!with_diskcache:--ignore=tests/test_reader_writer_lock.py} -v
|
||||
%else
|
||||
%pyproject_check_import -e 'fasteners.pywin32*'
|
||||
%endif
|
||||
@ -89,15 +73,8 @@ PYTHONPATH="${PWD}" \
|
||||
|
||||
%files -n python3-fasteners -f %{pyproject_files}
|
||||
# pyproject_files handles LICENSE; verify with “rpm -qL -p …”
|
||||
|
||||
|
||||
%files doc
|
||||
%license LICENSE
|
||||
%doc CHANGELOG
|
||||
%doc CHANGELOG.md
|
||||
%doc README.md
|
||||
%if %{with doc_pdf}
|
||||
%doc %{_vpath_builddir}/_latex/Fasteners.pdf
|
||||
%endif
|
||||
|
||||
|
||||
%changelog
|
||||
|
||||
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (fasteners-0.17.3.tar.gz) = bed890d674bbb8d0442cb0a36c81bd5d1b4e555534ce4451f1cf70dcf72e222d52ae98154d09ac0ad1e52d1a2026c532fd40df715fbbd6bc95f874a916911ec7
|
||||
SHA512 (fasteners-0.18.tar.gz) = 40928e93fa94ca9e67335d15acede73b70906885f8cc34262b00e2dfba9dfed8647f11490ab0df4c8fcfd94778362cfdc4bd0053063660b962202524dd5bda18
|
||||
|
||||
Loading…
Reference in New Issue
Block a user