Skip to content

Commit

Permalink
Added changes to make the test suite pass on Python 3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Nov 19, 2024
1 parent 9987427 commit d1b4f6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 8 additions & 2 deletions apscheduler/executors/pool.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import concurrent.futures
import multiprocessing
import sys
from abc import abstractmethod
from concurrent.futures.process import BrokenProcessPool

Expand Down Expand Up @@ -73,6 +73,12 @@ class ProcessPoolExecutor(BasePoolExecutor):

def __init__(self, max_workers=10, pool_kwargs=None):
pool_kwargs = pool_kwargs or {}
pool_kwargs.setdefault("mp_context", multiprocessing.get_context("spawn"))

# On Python 3.14, "spawn" is the default mp_context
if sys.version_info < (3, 14):
import multiprocessing

pool_kwargs.setdefault("mp_context", multiprocessing.get_context("spawn"))

pool = concurrent.futures.ProcessPoolExecutor(int(max_workers), **pool_kwargs)
super().__init__(pool)
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ tornado = ["tornado >= 4.3"]
twisted = ["twisted"]
zookeeper = ["kazoo"]
test = [
"APScheduler[gevent,mongodb,redis,rethinkdb,sqlalchemy,tornado,twisted,zookeeper,etcd]",
"APScheduler[mongodb,redis,rethinkdb,sqlalchemy,tornado,zookeeper,etcd]",
"pytest",
"pytest-asyncio >= 0.24.0",
"PySide6; python_implementation == 'CPython'",
"PySide6; python_implementation == 'CPython' and python_version < '3.14'",
"gevent; python_version < '3.14'",
"twisted; python_version < '3.14'",
]
doc = [
"APScheduler[gevent,mongodb,redis,rethinkdb,sqlalchemy,tornado,twisted,zookeeper,etcd]",
Expand Down Expand Up @@ -134,7 +136,7 @@ ignore = [
known-first-party = ["apscheduler"]

[tool.tox]
env_list = ["py38", "py39", "py310", "py311", "py312", "py313", "pypy3"]
env_list = ["py38", "py39", "py310", "py311", "py312", "py313", "py314", "pypy3"]
skip_missing_interpreters = true

[tool.tox.env_run_base]
Expand Down

0 comments on commit d1b4f6a

Please sign in to comment.