Look for the demo directory based on the test file name.
(path: str)
| 714 | |
| 715 | |
| 716 | def demo_dir(path: str) -> str: |
| 717 | """Look for the demo directory based on the test file name.""" |
| 718 | path = normpath(os.path.dirname(path)) |
| 719 | while True: |
| 720 | subdirs = [f.path for f in os.scandir(path) if f.is_dir()] |
| 721 | subdirs = [os.path.basename(d) for d in subdirs] |
| 722 | if "demo" in subdirs: |
| 723 | return os.path.join(path, "demo") |
| 724 | new_path = normpath(os.path.join(path, os.path.pardir)) |
| 725 | assert new_path != path |
| 726 | path = new_path |
| 727 | |
| 728 | |
| 729 | def normpath(path: str) -> str: |
no test coverage detected