MCPcopy Create free account
hub / github.com/zappa/Zappa / test_detects_nested_module

Method test_detects_nested_module

tests/test_websocket.py:448–463  ·  view source on GitHub ↗

Files in subdirectories should return dotted module paths.

(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected