Datasets:
Download scripts/reusable_support/crossswe_case_capture.py from CrossSWE/CrossSWE-Bench: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/scripts/reusable_support/crossswe_case_capture.py
- Command line
-
hf download hf://datasets/CrossSWE/CrossSWE-Bench/scripts/reusable_support/crossswe_case_capture.py
-
curl -L -o crossswe_case_capture.py https://huggingface.co/datasets/CrossSWE/CrossSWE-Bench/resolve/main/scripts/reusable_support/crossswe_case_capture.py
1.24 kB
| """Reporting-only pytest plugin injected by the evaluator after agent isolation.""" | |
| import json | |
| import os | |
| from pathlib import Path | |
| DATA = {'collected': [], 'reports': [], 'collection_errors': [], 'internal_errors': []} | |
| def pytest_collection_finish(session): | |
| DATA['collected'] = [item.nodeid for item in session.items] | |
| def pytest_collectreport(report): | |
| if report.failed: | |
| DATA['collection_errors'].append(str(report.longrepr)) | |
| def pytest_internalerror(excrepr, excinfo): | |
| DATA['internal_errors'].append(str(excrepr)) | |
| def pytest_runtest_logreport(report): | |
| DATA['reports'].append({'nodeid': report.nodeid, 'when': report.when, | |
| 'outcome': report.outcome, | |
| 'wasxfail': getattr(report, 'wasxfail', None)}) | |
| def pytest_sessionfinish(session, exitstatus): | |
| DATA['testscollected'] = session.testscollected | |
| DATA['exitstatus'] = int(exitstatus) | |
| dest = (Path(os.environ['CROSSSWE_CASE_REPORT_DIR']) / (str(os.getpid()) + '.json') | |
| if os.environ.get('CROSSSWE_CASE_REPORT_DIR') else Path(os.environ['CROSSSWE_CASE_REPORT'])) | |
| dest.parent.mkdir(parents=True, exist_ok=True) | |
| dest.write_text(json.dumps(DATA, indent=2, sort_keys=True) + '\n') | |