MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / _test_all

Function _test_all

tests/test_docs_samples.py:27–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 samples.append(p)
26
27def _test_all():
28 # Allow runnings tests directly without pytest.
29 import subprocess
30 import sys
31 e = 0
32 for sample in samples:
33 print( f'Running: {sample}', flush=1)
34 try:
35 if 0:
36 # Curiously this fails in an odd way when testing compound
37 # package with $PYTHONPATH set.
38 print( f'os.environ is:')
39 for n, v in os.environ.items():
40 print( f' {n}: {v!r}')
41 command = f'{sys.executable} {sample}'
42 print( f'command is: {command!r}')
43 sys.stdout.flush()
44 subprocess.check_call( command, shell=1, text=1)
45 else:
46 runpy.run_path(sample)
47 except Exception:
48 print( f'Failed: {sample}')
49 e += 1
50 if e:
51 raise Exception( f'Errors: {e}')
52
53# We use pytest.mark.parametrize() to run sample scripts via a fn, which
54# ensures that pytest treats each script as a test.

Callers

nothing calls this directly

Calls 1

flushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…