Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: Avoid the multiprocessing forkserver method #2173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions tests/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
from tests.support import mock


# The tests here are not compatible with the forkserver method,
# which is the default on Python 3.14+.
# See https://github.com/python/cpython/issues/125714
if multiprocessing.get_start_method() == 'forkserver':
mp_context = multiprocessing.get_context(method='fork')
else:
mp_context = multiprocessing.get_context()


class ConcurrencyMixin(object):
def __init__(self, lock):
self.lock = lock
Expand All @@ -61,11 +70,11 @@ def __init__(self, lock):
self.queue = dnf.pycomp.Queue(1)


class OtherProcess(ConcurrencyMixin, multiprocessing.Process):
class OtherProcess(ConcurrencyMixin, mp_context.Process):
def __init__(self, lock):
ConcurrencyMixin.__init__(self, lock)
multiprocessing.Process.__init__(self)
self.queue = multiprocessing.Queue(1)
mp_context.Process.__init__(self)
self.queue = mp_context.Queue(1)


TARGET = os.path.join(tests.support.USER_RUNDIR, 'unit-test.pid')
Expand Down
Loading