docstr: Submit and test a script with a dependency on a Spark Package
docstr_tok: ["Submit","and","test","a","script","with","a","dependency","on","a","Spark","Package"]
code: def test_package_dependency(self):
      """Submit and test a script with a dependency on a Spark Package"""
      script = self.createTempFile(
          "test.py",
          """
              |from pyspark import SparkContext
              |from mylib import myfunc
              |
              |sc = SparkContext()
              |print(sc.parallelize([1, 2, 3]).map(myfunc).collect())
              """,
      )
      self.create_spark_package("a:mylib:0.1")
      proc = subprocess.Popen(
          self.sparkSubmit
          + [
              "--packages",
              "a:mylib:0.1",
              "--repositories",
              "file:" + self.programDir,
              script,
          ],
          stdout=subprocess.PIPE,
      )
      out, err = proc.communicate()
      self.assertEqual(0, proc.returncode)
      self.assertIn("[2, 3, 4]", out.decode("utf-8"))
  
imports: import os
  import re
  import shutil
  import subprocess
  import tempfile
  import unittest
  import zipfile
  from pyspark.testing.utils import SPARK_HOME
label_desc: Use image node_id 10 for calling the SparkSubmitTests obj's underlying member method code with example usage: obj.test_package_dependency() without return types