| Cole Faust | af4b13d | 2022-09-14 15:25:15 -0700 | [diff] [blame] | 1 | import unittest | 
| 2 | import sys | ||||
| 3 | |||||
| 4 | print(sys.path, file=sys.stderr) | ||||
| 5 | |||||
| 6 | class TestProtoWithPkgPath(unittest.TestCase): | ||||
| 7 | |||||
| 8 | def test_cant_import_mymodule_directly(self): | ||||
| 9 | with self.assertRaises(ImportError): | ||||
| 10 | import mymodule | ||||
| 11 | |||||
| 12 | def test_can_import_mymodule_by_parent_package(self): | ||||
| 13 | import mypkg.mymodule | ||||
| 14 | |||||
| 15 | |||||
| 16 | if __name__ == '__main__': | ||||
| 17 | unittest.main() | ||||