我正在通过Jenkins使用pytest运行一组单元测试用例。我可以在本地运行测试用例,但在詹金斯中抛出错误。我无法理解根本原因。谁能帮我这个忙吗?我正在附上错误消息。
____________________ ERROR at setup of test_npm_hh_demos_tc ____________________
request = <SubRequest 'spark_context' for <Function 'test_npm_hh_demos_tc'>>
@pytest.fixture(scope="session")
def spark_context(request):
conf = (SparkConf().setMaster("local[2]").setAppName("pytest-pyspark-local-testing"))
request.addfinalizer(lambda: sc.stop())
> sc = SparkContext(conf=conf).getOrCreate()
/temp/workspace/ON-Pipeline_feature_rahul_test12/extracts/src/test/conftest.py:13:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/tmf_env/lib/python3.6/site-packages/pyspark/context.py:115: in __init__
SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
/tmf_env/lib/python3.6/site-packages/pyspark/context.py:292: in _ensure_initialized
SparkContext._gateway = gateway or launch_gateway(conf)
/tmf_env/lib/python3.6/site-packages/pyspark/java_gateway.py:93: Exception
---------------------------- Captured stderr setup -----------------------------
/usr/bin/id: cannot find name for group ID 25198
/usr/bin/id: cannot find name for user ID 1009100
/usr/bin/id: cannot find name for group ID 25198
/usr/bin/id: cannot find name for user ID 1009100
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/spark/launcher/Main : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.spark.launcher.Main. Program will exit