Does module look like a test module or a script?
(module: str)
| 1638 | |
| 1639 | |
| 1640 | def is_non_library_module(module: str) -> bool: |
| 1641 | """Does module look like a test module or a script?""" |
| 1642 | if module.endswith( |
| 1643 | ( |
| 1644 | ".tests", |
| 1645 | ".test", |
| 1646 | ".testing", |
| 1647 | "_tests", |
| 1648 | "_test_suite", |
| 1649 | "test_util", |
| 1650 | "test_utils", |
| 1651 | "test_base", |
| 1652 | ".__main__", |
| 1653 | ".conftest", # Used by pytest |
| 1654 | ".setup", # Typically an install script |
| 1655 | ) |
| 1656 | ): |
| 1657 | return True |
| 1658 | if module.split(".")[-1].startswith("test_"): |
| 1659 | return True |
| 1660 | if ( |
| 1661 | ".tests." in module |
| 1662 | or ".test." in module |
| 1663 | or ".testing." in module |
| 1664 | or ".SelfTest." in module |
| 1665 | ): |
| 1666 | return True |
| 1667 | return False |
| 1668 | |
| 1669 | |
| 1670 | def translate_module_name(module: str, relative: int) -> tuple[str, int]: |
searching dependent graphs…