如何解决pytes中的弃用警告

2024-04-27 04:11:23 发布

您现在位置:Python中文网/ 问答频道 /正文

下面是我正在使用的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是利用率你知道吗

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的新手,找不到解决这个问题的方法。谁能帮我一下我做错了什么。我知道第三个测试用例是这样的,因为当我去掉前两个测试用例时,它可以正常工作。你知道吗


Tags: 代码infromtestimportselfdfpytest
1条回答
网友
1楼 · 发布于 2024-04-27 04:11:23

如果尚未更新python,请尝试使用python2运行程序。这可能有效,也可能无效,这取决于程序的使用年限。你知道吗

相关问题 更多 >