|
15 | 15 | from unblob import handlers |
16 | 16 | from unblob.models import Handler |
17 | 17 | from unblob.processing import ExtractionConfig, process_file |
| 18 | +from unblob.sandbox import AccessFS, Sandbox |
18 | 19 | from unblob.testing import ( |
19 | 20 | check_output_is_the_same, |
20 | 21 | check_result, |
|
29 | 30 | "input_dir, output_dir", gather_integration_tests(TEST_DATA_PATH) |
30 | 31 | ) |
31 | 32 | def test_all_handlers( |
32 | | - input_dir: Path, output_dir: Path, extraction_config: ExtractionConfig |
| 33 | + input_dir: Path, |
| 34 | + output_dir: Path, |
| 35 | + extraction_config: ExtractionConfig, |
| 36 | + request: pytest.FixtureRequest, |
33 | 37 | ): |
| 38 | + log_path = Path("/dev/null") # no logging |
| 39 | + report_file = None # no reporting |
| 40 | + |
| 41 | + passthrough = [ |
| 42 | + # .pytest_cache |
| 43 | + AccessFS.read_write(request.config.rootpath), |
| 44 | + ] |
| 45 | + junit_xmlpath = request.config.getvalue("xmlpath") |
| 46 | + if junit_xmlpath: |
| 47 | + passthrough += [ |
| 48 | + # junit reports are written to the argument of --junit-xml |
| 49 | + AccessFS.read_write(junit_xmlpath) # type: ignore |
| 50 | + ] |
| 51 | + |
| 52 | + sandbox = Sandbox(extraction_config, log_path, report_file, passthrough) |
34 | 53 | for input_file in input_dir.iterdir(): |
35 | | - reports = process_file(extraction_config, input_file) |
| 54 | + reports = sandbox.run(process_file, extraction_config, input_file) |
36 | 55 | check_result(reports) |
37 | 56 |
|
38 | 57 | check_output_is_the_same(output_dir, extraction_config.extract_root) |
|
0 commit comments