Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 0 additions & 11 deletions tests/chaos/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,3 @@ def deleted_pod_by_name_prefix(admin_client, cnv_pod_deletion_test_matrix__class
namespace=pod_deletion_config["namespace_name"],
pod_prefix=pod_deletion_config["pod_prefix"],
)


Comment thread
carterpewpew marked this conversation as resolved.
@pytest.fixture(scope="module")
def multiprocessing_start_method_fork():
# Use fork context to avoid pickling issues with nested functions
# https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process
# https://github.com/python/cpython/issues/132898
original_start_method = multiprocessing.get_start_method()
multiprocessing.set_start_method("fork", force=True)
yield
multiprocessing.set_start_method(original_start_method, force=True)
17 changes: 17 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import copy
import logging
import multiprocessing
import os
import os.path
import re
Expand Down Expand Up @@ -227,6 +228,22 @@
AUDIT_LOG_PATTERN = re.compile(r"audit-(\d{4}-\d{2}-\d{2})T(\d{2})-(\d{2})-(\d{2}\.\d{3})\.log")


@pytest.fixture(scope="module")
def multiprocessing_start_method_fork():
Comment thread
carterpewpew marked this conversation as resolved.
"""Temporarily set multiprocessing start method to ``fork``.

Side effects:
Changes the process-global multiprocessing start method to ``fork``
for the module lifetime, then restores the previous method on teardown.
"""
# https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Process
# https://github.com/python/cpython/issues/132898
original_start_method = multiprocessing.get_start_method()
multiprocessing.set_start_method("fork", force=True)
yield
multiprocessing.set_start_method(original_start_method, force=True)
Comment thread
carterpewpew marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.


@pytest.fixture(scope="session")
def junitxml_polarion(record_testsuite_property):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/storage/cdi_upload/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def _upload_image(dv_name, namespace, storage_class, local_name, client):
@pytest.mark.sno
@pytest.mark.s390x
@pytest.mark.polarion("CNV-2015")
@pytest.mark.usefixtures("multiprocessing_start_method_fork")
@pytest.mark.parametrize(
"upload_file_path",
[
Expand Down