Update code locations in test case output to point to the .test file. The description of the test case is written to native.py, and line numbers in test case output often are relative to native.py. This translates the line numbers to be relative to the .test file that contains the test
(message: str, fnam: str, delta: int)
| 504 | |
| 505 | |
| 506 | def fix_native_line_number(message: str, fnam: str, delta: int) -> str: |
| 507 | """Update code locations in test case output to point to the .test file. |
| 508 | |
| 509 | The description of the test case is written to native.py, and line numbers |
| 510 | in test case output often are relative to native.py. This translates the |
| 511 | line numbers to be relative to the .test file that contains the test case |
| 512 | description, and also updates the file name to the .test file name. |
| 513 | |
| 514 | Args: |
| 515 | message: message to update |
| 516 | fnam: path of the .test file |
| 517 | delta: line number of the beginning of the test case in the .test file |
| 518 | |
| 519 | Returns updated message (or original message if we couldn't find anything). |
| 520 | """ |
| 521 | fnam = os.path.basename(fnam) |
| 522 | message = re.sub( |
| 523 | r"native\.py:([0-9]+):", lambda m: "%s:%d:" % (fnam, int(m.group(1)) + delta), message |
| 524 | ) |
| 525 | message = re.sub( |
| 526 | r'"native.py", line ([0-9]+),', |
| 527 | lambda m: '"%s", line %d,' % (fnam, int(m.group(1)) + delta), |
| 528 | message, |
| 529 | ) |
| 530 | return message |
| 531 | |
| 532 | |
| 533 | def copy_output_files(target_dir: str) -> None: |
no test coverage detected
searching dependent graphs…