docstr: Tests the same as test_walkpackages_filesys, only with a zip file.
docstr_tok: ["Tests","the","same","as","test_walkpackages_filesys",",","only","with","a","zip","file","."]
code: def test_walkpackages_zipfile(self):
      """Tests the same as test_walkpackages_filesys, only with a zip file."""
  
      zip = "test_walkpackages_zipfile.zip"
      pkg1 = "test_walkpackages_zipfile"
      pkg2 = "sub"
  
      zip_file = os.path.join(self.dirname, zip)
      z = zipfile.ZipFile(zip_file, "w")
      z.writestr(pkg2 + "/__init__.py", "")
      z.writestr(pkg2 + "/" + pkg1 + "/__init__.py", "")
      z.writestr(pkg2 + "/" + pkg1 + "/mod.py", "")
      z.writestr(pkg1 + "/__init__.py", "")
      z.writestr(pkg1 + "/" + pkg2 + "/__init__.py", "")
      z.writestr(pkg1 + "/" + pkg2 + "/mod.py", "")
      z.close()
  
      sys.path.insert(0, zip_file)
      expected = [
          "sub",
          "sub.test_walkpackages_zipfile",
          "sub.test_walkpackages_zipfile.mod",
          "test_walkpackages_zipfile",
          "test_walkpackages_zipfile.sub",
          "test_walkpackages_zipfile.sub.mod",
      ]
      actual = [e[1] for e in pkgutil.walk_packages([zip_file])]
      self.assertEqual(actual, expected)
      del sys.path[0]
  
      for pkg in expected:
          if pkg.endswith("mod"):
              continue
          del sys.modules[pkg]
  
imports: from pathlib import Path
  from test.support.import_helper import unload, CleanImport
  from test.support.warnings_helper import check_warnings, ignore_warnings
  import unittest
  import sys
  import importlib
  from importlib.util import spec_from_file_location
  import pkgutil
  import os
  import os.path
  import tempfile
  import shutil
  import zipfile
label_desc: Use image node_id 8 for calling the PkgutilTests obj's underlying member method code with example usage: obj.test_walkpackages_zipfile() without return types