################################################################ # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. """Runs the large fixture scripts in aootest_worker/fixtures (copied from the ODF harness's fixtures/*/make.py) inside the worker. They were written as stand-alone programs: `make.py `. Here they run under runpy with that argv, an `unohelp` that hands them the worker's connection, and two guards for what cannot work from inside the worker: os._exit (the draw script ends with it) and subprocess.run (the draw script's watchdog restarts the office with a script of the old harness). They do not run as `__main__`: pyuno keeps its runtime in that module's dict, and runpy swaps it out while a script runs.""" import contextlib import os import runpy import subprocess import sys import traceback from pathlib import Path from aootest_worker import unohelp FIXTURES = Path(__file__).resolve().parent.parent / "fixtures" def _no_exit(code=0): raise SystemExit(code) def _no_run(*args, **kwargs): raise RuntimeError("a fixture script cannot restart the office from inside the worker") def run_script(script, outdir, args=()): """Runs fixtures/