You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:48:56 UTC

[buildstream] 15/27: WIP: mv set_start_method to conftest.py

This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a commit to branch aevri/check_spawn_ci_working
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 9bfade0f127f846860e1bfcf1cba2dd526ffa8ad
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Thu Oct 17 08:32:31 2019 +0100

    WIP: mv set_start_method to conftest.py
---
 src/buildstream/testing/_utils/site.py |  5 -----
 tests/conftest.py                      | 12 ++++++++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/buildstream/testing/_utils/site.py b/src/buildstream/testing/_utils/site.py
index 1b631f4..6fd0473 100644
--- a/src/buildstream/testing/_utils/site.py
+++ b/src/buildstream/testing/_utils/site.py
@@ -79,11 +79,6 @@ MACHINE_ARCH = Platform.get_host_arch()
 
 HAVE_SANDBOX = os.getenv('BST_FORCE_SANDBOX')
 
-# TODO: document
-if 'BST_FORCE_START_METHOD' in os.environ:
-    start_method = os.environ['BST_FORCE_START_METHOD']
-    multiprocessing.set_start_method(start_method)
-
 if HAVE_SANDBOX is not None:
     pass
 elif IS_LINUX and HAVE_BWRAP and (not IS_WSL):
diff --git a/tests/conftest.py b/tests/conftest.py
index 68fdba7..4b1d77b 100755
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -20,6 +20,7 @@
 #        Tristan Maat <tr...@codethink.co.uk>
 #
 import os
+import multiprocessing
 import pytest
 
 from buildstream.testing import register_repo_kind, sourcetests_collection_hook
@@ -155,3 +156,14 @@ def set_xdg_paths(pytestconfig):
             value = os.path.join(pytestconfig.getoption("basetemp"), default)
 
         os.environ[env_var] = value
+
+
+def pytest_configure(config):
+    # TODO: document
+    print(
+        "Multiprocessing method:",
+        multiprocessing.get_start_method(allow_none=True),
+    )
+    if 'BST_FORCE_START_METHOD' in os.environ:
+        start_method = os.environ['BST_FORCE_START_METHOD']
+        multiprocessing.set_start_method(start_method)