| 1 | import importlib |
| 2 | import pathlib |
| 3 | import unittest |
| 4 | |
| 5 | |
| 6 | class Layers(unittest.TestCase): |
| 7 | def test_both_import_cleanly_in_isolation(self): |
| 8 | for name in ("api", "store"): |
| 9 | importlib.import_module(name) |
| 10 | |
| 11 | def test_each_binds_the_other_at_module_level(self): |
| 12 | api = pathlib.Path("api.py").read_text().split("def ")[0] |
| 13 | store = pathlib.Path("store.py").read_text().split("def ")[0] |
| 14 | self.assertIn("from store import TABLES", api) |
| 15 | self.assertIn("from api import HANDLERS", store) |
| 16 |