|
62 | 62 | specified PyMuPDF will download its default mupdf .tgz.] |
63 | 63 | -p <pytest-options> |
64 | 64 | Set pytest options; default is ''. |
| 65 | + -P 0|1 |
| 66 | + If 1, automatically install required packages such as Valgrind. Default |
| 67 | + is 0. |
65 | 68 | -s 0 | 1 |
66 | 69 | If 1 (the default), build with Python Limited API/Stable ABI. |
67 | 70 | -t <names> |
@@ -174,6 +177,7 @@ def main(argv): |
174 | 177 | pytest_k = None |
175 | 178 | system_site_packages = False |
176 | 179 | pyodide_build_version = None |
| 180 | + packages = False |
177 | 181 |
|
178 | 182 | options = os.environ.get('PYMUDF_SCRIPTS_TEST_options', '') |
179 | 183 | options = shlex.split(options) |
@@ -210,7 +214,9 @@ def main(argv): |
210 | 214 | elif arg == '-k': |
211 | 215 | pytest_k = next(args) |
212 | 216 | elif arg == '-p': |
213 | | - pytest_options = next(args) |
| 217 | + pytest_options = next(args) |
| 218 | + elif arg == '-P': |
| 219 | + packages = int(next(args)) |
214 | 220 | elif arg == '-s': |
215 | 221 | value = next(args) |
216 | 222 | assert value in ('0', '1'), f'`-s` must be followed by `0` or `1`, not {value=}.' |
@@ -289,6 +295,7 @@ def do_test(): |
289 | 295 | test_fitz=test_fitz, |
290 | 296 | pytest_k=pytest_k, |
291 | 297 | pybind=pybind, |
| 298 | + packages=packages, |
292 | 299 | ) |
293 | 300 |
|
294 | 301 | for command in commands: |
@@ -630,6 +637,7 @@ def test( |
630 | 637 | test_fitz=True, |
631 | 638 | pytest_k=None, |
632 | 639 | pybind=False, |
| 640 | + packages=False, |
633 | 641 | ): |
634 | 642 | ''' |
635 | 643 | Args: |
@@ -737,9 +745,10 @@ def getmtime(path): |
737 | 745 | run_compound_args += f' -t {timeout}' |
738 | 746 | env_extra = None |
739 | 747 | if valgrind: |
740 | | - log('Installing valgrind.') |
741 | | - run(f'sudo apt update') |
742 | | - run(f'sudo apt install --upgrade valgrind') |
| 748 | + if packages: |
| 749 | + log('Installing valgrind.') |
| 750 | + run(f'sudo apt update') |
| 751 | + run(f'sudo apt install --upgrade valgrind') |
743 | 752 | run(f'valgrind --version') |
744 | 753 |
|
745 | 754 | log('Running PyMuPDF tests under valgrind.') |
|
0 commit comments