Check that in the test file `filename` the slow decorator is always last.
(filename)
| 489 | |
| 490 | |
| 491 | def check_decorator_order(filename): |
| 492 | """Check that in the test file `filename` the slow decorator is always last.""" |
| 493 | with open(filename, "r", encoding="utf-8", newline="\n") as f: |
| 494 | lines = f.readlines() |
| 495 | decorator_before = None |
| 496 | errors = [] |
| 497 | for i, line in enumerate(lines): |
| 498 | search = _re_decorator.search(line) |
| 499 | if search is not None: |
| 500 | decorator_name = search.groups()[0] |
| 501 | if decorator_before is not None and decorator_name.startswith("parameterized"): |
| 502 | errors.append(i) |
| 503 | decorator_before = decorator_name |
| 504 | elif decorator_before is not None: |
| 505 | decorator_before = None |
| 506 | return errors |
| 507 | |
| 508 | |
| 509 | def check_all_decorator_order(): |
no outgoing calls
no test coverage detected