Compare commits

..

No commits in common. "rawhide" and "f40" have entirely different histories.

6 changed files with 18 additions and 117 deletions

1
.gitignore vendored
View file

@ -4,4 +4,3 @@
/APScheduler-3.7.0.tar.gz /APScheduler-3.7.0.tar.gz
/APScheduler-3.8.0.tar.gz /APScheduler-3.8.0.tar.gz
/APScheduler-3.10.4.tar.gz /APScheduler-3.10.4.tar.gz
/apscheduler-3.11.0.tar.gz

View file

@ -6,7 +6,7 @@ specfile_path: python-APScheduler.spec
upstream_package_name: APScheduler upstream_package_name: APScheduler
downstream_package_name: python-APScheduler downstream_package_name: python-APScheduler
upstream_project_url: https://github.com/agronholm/apscheduler upstream_project_url: https://github.com/agronholm/apscheduler
version_update_mask: '\d+\.' version_update_mask: '\d+\.\d+\.'
upstream_tag_exclude: "^4.[0-9].[0-9]a" # exclude version 4 alpha releases upstream_tag_exclude: "^4.[0-9].[0-9]a" # exclude version 4 alpha releases
packit_instances: ["stg"] packit_instances: ["stg"]

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 +1,3 @@
This repository is maintained by packit. This repository is maintained by packit.
https://packit.dev/ https://packit.dev/
The file was generated using packit 0.104.1.post1.dev0+g23aec6b3.d20241128. The file was generated using packit 0.83.0.post1.dev4+g46d87465.d20231011.

View file

@ -1,3 +1,4 @@
%global srcname APScheduler
%global _description %{expand: %global _description %{expand:
Advanced Python Scheduler (APScheduler) is a Python library that lets you Advanced Python Scheduler (APScheduler) is a Python library that lets you
schedule your Python code to be executed later, either just once or schedule your Python code to be executed later, either just once or
@ -7,36 +8,39 @@ 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 restarted, it will then run all the jobs it should have run while it was
offline.} offline.}
Name: python-APScheduler Name: python-%{srcname}
Version: 3.11.0 Version: 3.10.4
Release: %autorelease Release: %autorelease
Summary: In-process task scheduler with Cron-like capabilities Summary: In-process task scheduler with Cron-like capabilities
License: MIT License: MIT
URL: https://pypi.org/project/APScheduler/ URL: https://pypi.org/project/APScheduler/
Source0: %{pypi_source apscheduler} Source0: %{pypi_source %{srcname}}
BuildArch: noarch BuildArch: noarch
%description %_description %description %_description
%package -n python3-APScheduler %package -n python3-%{srcname}
Summary: %{summary} Summary: %{summary}
BuildRequires: python3-devel BuildRequires: python3-devel
%description -n python3-APScheduler %_description %description -n python3-%{srcname} %_description
%prep %prep
%autosetup -n apscheduler-%{version} -p1 %autosetup -n %{srcname}-%{version} -p1
# Remove that test as it require services (redis, zookeeper, ...) # Remove that test as it require services (redis, zookeeper, ...)
# up and running. Upstream provides a docker compose to spawn # up and running. Upstream provides a docker compose to spawn
# services before running these tests. # services before running these tests.
rm tests/test_jobstores.py rm tests/test_jobstores.py
# Skip missing dependencies in Fedora 42 sed -i 's/pytest-tornado5/pytest-tornado/' setup.py
sed -i 's/ "anyio >= 4.5.2",//' pyproject.toml # Remove coverage
sed -i 's/,rethinkdb//' pyproject.toml sed -i 's/addopts = -rsx --cov/addopts = -rsx/' setup.cfg
sed -i '/pytest-cov/d' setup.py
# It is in the tarball and is not used
rm -r APScheduler.egg-info
%generate_buildrequires %generate_buildrequires
%pyproject_buildrequires -x test -x tornado %pyproject_buildrequires -x testing -x tornado
%build %build
%pyproject_wheel %pyproject_wheel
@ -50,7 +54,7 @@ sed -i 's/,rethinkdb//' pyproject.toml
export TZ=UTC export TZ=UTC
%pytest %pytest
%files -n python3-APScheduler -f %{pyproject_files} %files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst %doc README.rst
%changelog %changelog

View file

@ -1 +1 @@
SHA512 (apscheduler-3.11.0.tar.gz) = c66d87773d3fe353e5f0bbc4bc9ba05337b555db0810e42e2e384fd9717438fda501d0c724cd7180010b11e5d8db901922b79a163aec3a420a6a65eafb6f39f6 SHA512 (APScheduler-3.10.4.tar.gz) = 44b78e60b7349437fb8d6e5ad3bbd764cfa653fdd65685b586119225e8daaff9b150871887812a1f3d4cd67b942c70e99d1606d38b83685953fb1bb1a82742fe