以下是我正在使用的pytest代码:
from config import BatchId
from util import readParquetFiles,startSparkSession
import pytest
pytest.x = 100
pytest.spark = startSparkSession()
pytest.path = "D:\\filepath\\"
class TestStringMethods:
@pytest.mark.order1
def test_one(self):
print("\nthis is first")
pytest.x=BatchId
@pytest.mark.order2
def test_two(self):
print("\nthis is second")
@pytest.mark.order3
def test_three(self):
df= readParquetFiles(pytest.spark,pytest.path)
print("df.count {}: ".format(df.count()))
readParquetFiles是util.py中的方法
def readParquetFiles(spark,pathToLoad):
parquetFiles = [f for f in glob.glob(pathToLoad + "**/*.parquet", recursive=True)]
parquetDF = spark.read.load(parquetFiles)
return parquetDF;
执行此代码时,我得到以下警告:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
======================================== 3 passed, 6 warnings in 6.96 seconds =========================================
我是pytest的新手,找不到解决此问题的方法。谁能帮我在这里做错了什么。我知道第三个测试用例可以做到这一点,因为当我删除前两个用例时,效果很好。
答案 0 :(得分:0)
如果尚未更新python,请尝试使用python2
运行该程序。这可能会或可能不会起作用,具体取决于程序的年龄。