Compare commits

..

1 commit

Author SHA1 Message Date
Fabien Boucher
fc5f60c441 Fix 1714212 - failing test - prevent rebuild 2020-06-16 14:17:43 +02:00
10 changed files with 160 additions and 294 deletions

5
.gitignore vendored
View file

@ -1,7 +1,2 @@
/APScheduler-3.0.5.tar.gz
/APScheduler-3.5.3.tar.gz
/APScheduler-3.6.3.tar.gz
/APScheduler-3.7.0.tar.gz
/APScheduler-3.8.0.tar.gz
/APScheduler-3.10.4.tar.gz
/apscheduler-3.11.0.tar.gz

View file

@ -1,38 +0,0 @@
# See the documentation for more information:
# https://packit.dev/docs/configuration/
specfile_path: python-APScheduler.spec
upstream_package_name: APScheduler
downstream_package_name: python-APScheduler
upstream_project_url: https://github.com/agronholm/apscheduler
version_update_mask: '\d+\.'
upstream_tag_exclude: "^4.[0-9].[0-9]a" # exclude version 4 alpha releases
packit_instances: ["stg"]
jobs:
- job: copr_build
owner: mmassari
project: apscheduler
trigger: pull_request
targets:
- fedora-all
- job: pull_from_upstream
trigger: release
dist_git_branches:
- fedora-all
- job: koji_build
trigger: commit
allowed_pr_authors: ["packit-stg", "packit", "mmassari"]
allowed_committers: ["mmassari"]
dist_git_branches:
- fedora-all
- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched # rawhide updates are created automatically

View file

@ -0,0 +1,55 @@
From ea99dae0b4b0cfcd232498e8af832874fdaeb983 Mon Sep 17 00:00:00 2001
From: Fabien Boucher <fboucher@redhat.com>
Date: Tue, 16 Jun 2020 13:47:17 +0200
Subject: [PATCH] use pytest.param in parametrize decorator
---
tests/test_util.py | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/tests/test_util.py b/tests/test_util.py
index 973b81a..81d37c2 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -215,20 +215,25 @@ class TestObjToRef(object):
assert str(exc.value) == 'Cannot create a reference to a nested function'
@pytest.mark.parametrize('input,expected', [
- pytest.mark.skipif(sys.version_info[:2] == (3, 2),
- reason="Unbound methods can't be resolved on Python 3.2")(
- (DummyClass.meth, 'tests.test_util:DummyClass.meth')
- ),
+ pytest.param(
+ DummyClass.meth,
+ 'tests.test_util:DummyClass.meth',
+ marks=pytest.mark.skipif(
+ sys.version_info[:2] == (3, 2),
+ reason="Unbound methods can't be resolved on Python 3.2")),
(DummyClass.classmeth, 'tests.test_util:DummyClass.classmeth'),
- pytest.mark.skipif(sys.version_info < (3, 3),
- reason="Requires __qualname__ (Python 3.3+)")(
- (DummyClass.InnerDummyClass.innerclassmeth,
- 'tests.test_util:DummyClass.InnerDummyClass.innerclassmeth')
- ),
- pytest.mark.skipif(sys.version_info < (3, 3),
- reason="Requires __qualname__ (Python 3.3+)")(
- (DummyClass.staticmeth, 'tests.test_util:DummyClass.staticmeth')
- ),
+ pytest.param(
+ DummyClass.InnerDummyClass.innerclassmeth,
+ 'tests.test_util:DummyClass.InnerDummyClass.innerclassmeth',
+ marks=pytest.mark.skipif(
+ sys.version_info < (3, 3),
+ reason="Requires __qualname__ (Python 3.3+)")),
+ pytest.param(
+ DummyClass.staticmeth,
+ 'tests.test_util:DummyClass.staticmeth',
+ marks=pytest.mark.skipif(
+ sys.version_info < (3, 3),
+ reason="Requires __qualname__ (Python 3.3+)")),
(timedelta, 'datetime:timedelta'),
], ids=['unbound method', 'class method', 'inner class method', 'static method', 'timedelta'])
def test_valid_refs(self, input, expected):
--
2.25.4

View file

@ -1,102 +0,0 @@
diff --git a/setup.cfg b/setup.cfg
index 002111f..012cff4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -7,7 +7,7 @@ upload-dir = docs/_build/html
[tool:pytest]
asyncio_mode = strict
-addopts = -rsx --cov --tb=short
+addopts = -rsx --tb=short
testpaths = tests
[coverage:run]
diff --git a/setup.py b/setup.py
index cd93e10..59f5a80 100644
--- a/setup.py
+++ b/setup.py
@@ -56,7 +56,6 @@ setup(
'testing': [
'pytest',
'pytest_asyncio',
- 'pytest-cov',
'pytest-tornado5'
],
'doc': [
diff --git a/tests/test_executors.py b/tests/test_executors.py
index d67e187..0140dbe 100644
--- a/tests/test_executors.py
+++ b/tests/test_executors.py
@@ -5,6 +5,7 @@ import gc
import os
import signal
import time
+from time import sleep
import pytest
from pytz import UTC
@@ -36,11 +37,11 @@ def executor(request, mock_scheduler):
executor_ = ThreadPoolExecutor()
else:
from apscheduler.executors.pool import ProcessPoolExecutor
- executor_ = ProcessPoolExecutor()
+ executor_ = ProcessPoolExecutor(4, {"max_tasks_per_child": 1})
executor_.start(mock_scheduler, 'dummy')
yield executor_
- executor_.shutdown()
+ executor_.shutdown(True)
def wait_event():
@@ -60,12 +61,12 @@ def test_max_instances(mock_scheduler, executor, create_job, freeze_time):
"""Tests that the maximum instance limit on a job is respected."""
events = []
mock_scheduler._dispatch_event = lambda event: events.append(event)
- job = create_job(func=wait_event, max_instances=2, next_run_time=None)
+ job = create_job(func=wait_event, max_instances=2, next_run_time=None, misfire_grace_time = None)
executor.submit_job(job, [freeze_time.current])
executor.submit_job(job, [freeze_time.current])
pytest.raises(MaxInstancesReachedError, executor.submit_job, job, [freeze_time.current])
- executor.shutdown()
+ executor.shutdown(True)
assert len(events) == 2
assert events[0].retval == 'test'
assert events[1].retval == 'test'
@@ -83,12 +84,13 @@ def test_submit_job(mock_scheduler, executor, create_job, freeze_time, timezone,
"""
mock_scheduler._dispatch_event = MagicMock()
- job = create_job(func=func, id='foo')
+ misfire_grace_time = 1 if event_code == EVENT_JOB_MISSED else None
+ job = create_job(func=func, id='foo', misfire_grace_time=misfire_grace_time)
job._jobstore_alias = 'test_jobstore'
run_time = (timezone.localize(datetime(1970, 1, 1)) if event_code == EVENT_JOB_MISSED else
freeze_time.current)
executor.submit_job(job, [run_time])
- executor.shutdown()
+ executor.shutdown(True)
assert mock_scheduler._dispatch_event.call_count == 1
event = mock_scheduler._dispatch_event.call_args[0][0]
@@ -157,18 +159,13 @@ def test_broken_pool():
pid = [None]
event = Event()
- scheduler = BackgroundScheduler(executors={'default': ProcessPoolExecutor(1)})
+ scheduler = BackgroundScheduler(executors={'default': ProcessPoolExecutor(1, {"max_tasks_per_child": 1})})
scheduler.add_listener(listener, EVENT_JOB_EXECUTED)
scheduler.add_job(os.getpid, 'date', run_date=datetime.now(UTC))
scheduler.start()
event.wait(3)
killed_pid = pid[0]
- os.kill(pid[0], signal.SIGTERM)
- try:
- os.waitpid(pid[0], 0)
- except OSError:
- pass
event.clear()
scheduler.add_job(os.getpid, 'date', run_date=datetime.now(UTC))

View file

@ -1,3 +0,0 @@
This repository is maintained by packit.
https://packit.dev/
The file was generated using packit 0.104.1.post1.dev0+g23aec6b3.d20241128.

View file

@ -1,79 +0,0 @@
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 3.8.0-3
- Rebuilt for Python 3.11
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Sep 23 2021 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 3.8.0-1
- Update to 3.8.0 (#1917870)
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 3.7.0-3
- Rebuilt for Python 3.10
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jan 20 2021 Fabien Boucher <fboucher@redhat.com> - 3.7.0-1
- Upstream 3.7.0 (RHBZ#1917870)
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 20 2020 Fabien Boucher <fboucher@redhat.com> - 3.6.3-3
- Update project url
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 3.6.3-2
- Rebuilt for Python 3.9
* Wed Mar 11 2020 Fabien Boucher <fboucher@redhat.com> - 3.6.3-1
- Inport from SF packaging and bump to 3.6.3 (#1813957)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.5.3-4
- Rebuilt for Python 3.8
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sun Dec 16 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.3-2
- Subpackage python2-APScheduler has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
* Mon Aug 20 2018 Haïkel Guémar <hguemar@fedoraproject.org> - 3.5.3-1
- Upstream 3.5.3 (RHBZ#1605579)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.0.5-9
- Rebuilt for Python 3.7
* Wed Feb 21 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.0.5-8
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.0.5-4
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Sat Dec 19 2015 Paul Belanger <pabelanger@redhat.com> - 3.0.5-1
- Initial packaging (#1218410)

View file

@ -1,57 +1,125 @@
%global _description %{expand:
%global pypi_name APScheduler
Name: python-%{pypi_name}
Version: 3.5.3
Release: 4%{?dist}
Summary: In-process task scheduler with Cron-like capabilities
License: MIT
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://pypi.python.org/packages/source/A/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Patch0: 0001-use-pytest.param-in-parametrize-decorator.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-setuptools_scm
BuildRequires: python3-six >= 1.4.0
BuildRequires: python3-tzlocal
# Unit testing
BuildRequires: python3-mock
BuildRequires: python3-pytest
BuildRequires: python3-pytest-cov
BuildRequires: python3-pytest-asyncio
BuildRequires: python3-pytest-tornado
BuildRequires: python3-tornado
%description
Advanced Python Scheduler (APScheduler) is a Python library that lets you
schedule your Python code to be executed later, either just once or
periodically. You can add new jobs or remove old ones on the fly as you
please. If you store your jobs in a database, they will also survive
scheduler restarts and maintain their state. When the scheduler is
restarted, it will then run all the jobs it should have run while it was
offline.}
periodically.
Name: python-APScheduler
Version: 3.11.0
Release: %autorelease
Summary: In-process task scheduler with Cron-like capabilities
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
License: MIT
URL: https://pypi.org/project/APScheduler/
Source0: %{pypi_source apscheduler}
BuildArch: noarch
Requires: python3-six >= 1.4.0
Requires: python3-tzlocal
%description %_description
%description -n python3-%{pypi_name}
Advanced Python Scheduler (APScheduler) is a Python library that lets you
schedule your Python code to be executed later, either just once or
periodically.
%package -n python3-APScheduler
Summary: %{summary}
BuildRequires: python3-devel
%package doc
Summary: Documentation of the Advanced Python Scheduler library
BuildRequires: python3-sphinx
%description -n python3-APScheduler %_description
%description doc
Documentation of the Advanced Python Scheduler library.
%prep
%autosetup -n apscheduler-%{version} -p1
# Remove that test as it require services (redis, zookeeper, ...)
# up and running. Upstream provides a docker compose to spawn
# services before running these tests.
rm tests/test_jobstores.py
# Skip missing dependencies in Fedora 42
sed -i 's/ "anyio >= 4.5.2",//' pyproject.toml
sed -i 's/,rethinkdb//' pyproject.toml
%generate_buildrequires
%pyproject_buildrequires -x test -x tornado
%autosetup -p1 -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info
%build
%pyproject_wheel
%py3_build
## generate html docs
%{__python3} setup.py build_sphinx
rm -rf docs/_build/html/.{doctrees,buildinfo} docs/_build/html/objects.inv
%install
%pyproject_install
%pyproject_save_files apscheduler
%py3_install
%check
# Default timezone to UTC otherwise unit tests fail.
export TZ=UTC
%pytest
# TestBaseScheduler.test_create_trigger_bad_plugin_type does incorrect mocking
# TestIntervalTrigger.test_repr - changed timedelta repr in Python 3.7
# both fixed upstream
%{__python3} -m pytest -k "not (TestIntervalTrigger and test_repr) and not test_create_trigger_bad_plugin_type"
%files -n python3-APScheduler -f %{pyproject_files}
%files -n python3-%{pypi_name}
%license LICENSE.txt
%doc README.rst
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/
%{python3_sitelib}/apscheduler/
%files doc
%doc docs/_build/html
%changelog
%autochangelog
* Tue Jun 16 2020 Fabien Boucher <fboucher@redhat.com> - 3.5.3-4
- Patch to fix #1714212 due to marks in pytest.mark.parametrize deprecated
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sun Dec 16 2018 Miro Hrončok <mhroncok@redhat.com> - 3.5.3-2
- Subpackage python2-APScheduler has been removed
See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
* Mon Aug 20 2018 Haïkel Guémar <hguemar@fedoraproject.org> - 3.5.3-1
- Upstream 3.5.3 (RHBZ#1605579)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.0.5-9
- Rebuilt for Python 3.7
* Wed Feb 21 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.0.5-8
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.0.5-4
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Sat Dec 19 2015 Paul Belanger <pabelanger@redhat.com> - 3.0.5-1
- Initial packaging (#1218410)

View file

@ -1 +1 @@
SHA512 (apscheduler-3.11.0.tar.gz) = c66d87773d3fe353e5f0bbc4bc9ba05337b555db0810e42e2e384fd9717438fda501d0c724cd7180010b11e5d8db901922b79a163aec3a420a6a65eafb6f39f6
SHA512 (APScheduler-3.5.3.tar.gz) = dd3e98d0f474511851bdc109a1c65f7f97d221f95d086603d12b3f280285460234724369f05816e1754d58d94adadbec0deb8a0fa63fcd6531914d4a1f4fb3fc

View file

@ -1,19 +0,0 @@
#!/bin/bash
# Include Beaker environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
PACKAGE="python3-APScheduler"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlPhaseEnd
rlPhaseStartTest
rlRun "python3 -c 'import apscheduler'"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -1,11 +0,0 @@
---
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- atomic
tests:
- simple-test
required_packages:
- python3-APScheduler