def test_nonDirectoryPaths(self):
        """
        Verify that L{modules.walkModules} ignores entries in sys.path which
        refer to regular files in the filesystem.
        """
        existentPath = self.pathEntryWithOnePackage()

        nonDirectoryPath = FilePath(self.mktemp())
        self.assertFalse(nonDirectoryPath.exists())
        nonDirectoryPath.setContent(b"zip file or whatever\n")

        self.replaceSysPath([existentPath.path])

        beforeModules = list(modules.walkModules())
        sys.path.append(nonDirectoryPath.path)
        afterModules = list(modules.walkModules())

        self.assertEqual(beforeModules, afterModules)

        Verify that L{modules.walkModules} ignores entries in sys.path which
        refer to regular files in the filesystem.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_modules.py