summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-09-02 11:44:12 +0200
committerJürg Billeter <j@bitron.ch>2019-09-03 11:17:28 +0200
commitb4823df1c25ad5afd8449594b3b15b5676d6b9a6 (patch)
treef436af31da11879d244e1706f8b55828f24b3060
parent0963264d0021a9a0121ff769748814acbf1b8ff7 (diff)
downloadbuildstream-b4823df1c25ad5afd8449594b3b15b5676d6b9a6.tar.gz
testing/_forked.py: Update _MAIN_PID for tests running in subprocesses
This reduces the difference between regular execution and the test environment.
-rw-r--r--src/buildstream/testing/_forked.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buildstream/testing/_forked.py b/src/buildstream/testing/_forked.py
index af5e9c070..164906b0c 100644
--- a/src/buildstream/testing/_forked.py
+++ b/src/buildstream/testing/_forked.py
@@ -28,6 +28,8 @@ import pytest
# XXX Using pytest private internals here
from _pytest import runner
+from buildstream import utils
+
EXITSTATUS_TESTEXIT = 4
@@ -48,6 +50,10 @@ def serialize_report(rep):
def forked_run_report(item):
def runforked():
+ # This process is now the main BuildStream process
+ # for the duration of this test.
+ utils._MAIN_PID = os.getpid()
+
try:
reports = runner.runtestprotocol(item, log=False)
except KeyboardInterrupt: