()
| 25 | samples.append(p) |
| 26 | |
| 27 | def _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. |
nothing calls this directly
no test coverage detected
searching dependent graphs…