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

Function check

tests/test_general.py:1095–1121  ·  view source on GitHub ↗

Sets PYMUPDF_MESSAGE to `message` and PYMUPDF_LOG to `log`, runs `pymupdf internal`, and checks lines stdout and stderr match regexes in `expect_out` and `expect_err`. Note that we enclose regexes in `^...$`.

(
            expect_out,
            expect_err,
            message=None,
            log=None,
            )

Source from the content-addressed store, hash-verified

1093 del sys.path[0]
1094 pipcl.show_system()
1095 def check(
1096 expect_out,
1097 expect_err,
1098 message=None,
1099 log=None,
1100 ):
1101 '''
1102 Sets PYMUPDF_MESSAGE to `message` and PYMUPDF_LOG to `log`, runs
1103 `pymupdf internal`, and checks lines stdout and stderr match regexes in
1104 `expect_out` and `expect_err`. Note that we enclose regexes in `^...$`.
1105 '''
1106 env = dict()
1107 if log:
1108 env['PYMUPDF_LOG'] = log
1109 if message:
1110 env['PYMUPDF_MESSAGE'] = message
1111 command = 'pymupdf internal'
1112 print(f'Running: {command}', flush=1)
1113 if env:
1114 print(f'with:')
1115 for key in sorted(env.keys()):
1116 print(f' {key}={shlex.quote(env[key])}')
1117 env = os.environ | env
1118 cp = subprocess.run(command, shell=1, check=1, capture_output=1, env=env, text=True)
1119
1120 check_lines(expect_out, cp.stdout)
1121 check_lines(expect_err, cp.stderr)
1122
1123 print(f'test_cli_out(): {Py_GIL_DISABLED=}')
1124 print(f'test_cli_out(): {gil_enabled=}')

Callers 3

test_cli_outFunction · 0.70
test_use_python_loggingFunction · 0.70
test_openFunction · 0.70

Calls 4

check_linesFunction · 0.85
searchMethod · 0.80
runMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…