def test_packageMissingPath(self):
        """
        A package can delete its __path__ for some reasons,
        C{modules.PythonPath} should be able to deal with it.
        """
        mypath = FilePath(self.mktemp())
        mypath.createDirectory()
        pp = modules.PythonPath(sysPath=[mypath.path])
        subpath = mypath.child("abcd")
        subpath.createDirectory()
        subpath.child("__init__.py").setContent(b'del __path__\n')
        sys.path.append(mypath.path)
        __import__("abcd")
        try:
            l = list(pp.walkModules())
            self.assertEqual(len(l), 1)
            self.assertEqual(l[0].name, 'abcd')
        finally:
            del sys.modules['abcd']
            sys.path.remove(mypath.path)

        A package can delete its __path__ for some reasons,
        C{modules.PythonPath} should be able to deal with it.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_modules.py