36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
import os
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.parametrize('mode',['hash','copy','validate'])
|
|
def test_actual_app_exits_without_releasing_stalled_manifest_boundary(tmp_path,mode):
|
|
script=Path(__file__).parent/'support/manifest_process_exit.py'
|
|
env=dict(os.environ,QT_QPA_PLATFORM='offscreen')
|
|
child=subprocess.Popen([sys.executable,'-X','utf8',str(script),str(tmp_path),mode],
|
|
env=env,stdout=subprocess.PIPE,stderr=subprocess.PIPE,text=True)
|
|
exited=False
|
|
try:
|
|
deadline=time.monotonic()+8
|
|
while not (tmp_path/'main-returning').exists() and child.poll() is None and time.monotonic()<deadline:
|
|
time.sleep(.02)
|
|
assert (tmp_path/'entered').exists()
|
|
assert (tmp_path/'main-returning').exists()
|
|
try:
|
|
child.wait(timeout=1)
|
|
exited=True
|
|
except subprocess.TimeoutExpired:
|
|
pass
|
|
assert not (tmp_path/'late-dispatch').exists()
|
|
finally:
|
|
(tmp_path/'release').touch() # Failed-version cleanup is cooperative, never termination.
|
|
stdout,stderr=child.communicate(timeout=5)
|
|
assert child.returncode==0,(stdout,stderr)
|
|
assert not (tmp_path/'late-dispatch').exists()
|
|
if mode!='hash':assert (tmp_path/'partial-copy').is_dir()
|
|
assert exited,'Interpreter waited for nested metadata executor despite the completed UI close'
|