Files in subdirectories should return dotted module paths.
(self)
| 446 | os.chdir(old_cwd) |
| 447 | |
| 448 | def test_detects_nested_module(self): |
| 449 | """Files in subdirectories should return dotted module paths.""" |
| 450 | from zappa.cli import ZappaCLI |
| 451 | |
| 452 | with tempfile.TemporaryDirectory() as tmpdir: |
| 453 | pkg_dir = os.path.join(tmpdir, "mypackage") |
| 454 | os.makedirs(pkg_dir) |
| 455 | with open(os.path.join(pkg_dir, "ws.py"), "w") as f: |
| 456 | f.write("from zappa.websocket import on_connect\n") |
| 457 | |
| 458 | old_cwd = os.getcwd() |
| 459 | try: |
| 460 | os.chdir(tmpdir) |
| 461 | self.assertEqual(ZappaCLI._detect_websocket_usage(), "mypackage.ws") |
| 462 | finally: |
| 463 | os.chdir(old_cwd) |
| 464 | |
| 465 | def test_no_detection_without_import(self): |
| 466 | from zappa.cli import ZappaCLI |
nothing calls this directly
no test coverage detected