1import unittest 2import sys 3 4print(sys.path, file=sys.stderr) 5 6class 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 16if __name__ == '__main__': 17 unittest.main() 18