Python 如何解决pytest中的弃用警告
下面是我正在使用的pytest代码:Python 如何解决pytest中的弃用警告,python,pyspark,pytest,Python,Pyspark,Pytest,下面是我正在使用的pytest代码: from config import BatchId from util import readParquetFiles,startSparkSession import pytest pytest.x = 100 pytest.spark = startSparkSession() pytest.path = "D:\\filepath\\" class TestStringMethods: @pytes
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新手,无法找到解决此问题的方法。谁能帮我一下我做错了什么。我知道第三个测试用例就是这样的,因为当我删除前两个测试用例时,效果很好。如果您还没有更新python,那么请尝试使用
python2
运行程序。这可能有效,也可能无效,这取决于程序的使用年限。我使用的是python 3.7。你能告诉我为什么会出现这个错误,或者这是pytest中的一个bug吗?关于警告的一些细节。可能是由于您正在使用的某个模块。