diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-10-17 12:12:47 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-10-18 13:21:17 +0000 |
commit | 702dddae4197b43a93ec194f88457708a42119dd (patch) | |
tree | 69fb47f4f6bf6a4b887d3a4a2d93f10422227c66 /tests/conftest.py | |
parent | daf0bcf6da4c432ccf38d74c2097bc45b4ede485 (diff) | |
download | buildstream-702dddae4197b43a93ec194f88457708a42119dd.tar.gz |
tests/conftest: implement BST_FORCE_START_METHOD
Diffstat (limited to 'tests/conftest.py')
-rwxr-xr-x | tests/conftest.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 68fdba7fb..4aa7be7fb 100755 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,6 +20,7 @@ # Tristan Maat <tristan.maat@codethink.co.uk> # import os +import multiprocessing import pytest from buildstream.testing import register_repo_kind, sourcetests_collection_hook @@ -155,3 +156,17 @@ def set_xdg_paths(pytestconfig): value = os.path.join(pytestconfig.getoption("basetemp"), default) os.environ[env_var] = value + + +def pytest_configure(config): + # If we need to set_start_method() then we need to do it as early as + # possible. Note that some tests implicitly set the start method by using + # multiprocessing. If we wait for bst to do it, it will already be too + # late. + 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) |