Pytest坚持“收集…”

2024-05-16 06:19:10 发布

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

我有一个文件新脚本_管道.py使用我要测试的函数:

def columns_preparation(df):

    df.COLUMN_1.replace({'-999':'don't consider'}, inplace=True)
    ...more lines

    return df

以及测试文件测试新脚本_管道.py

^{pr2}$

所有文件都在同一目录中。我尝试过命令行:

python3 -m pytest new_script_piped.py
pytest new_script_piped.py
python -m pytest new_script_piped.py

他们都很讨厌:

platform darwin -- Python 3.7.3, pytest-4.5.0, py-1.8.0, pluggy-0.11.0
rootdir: /Users/31275553/Documents/
collecting ... 

其他解决方案建议检查拼写错误,并确保所有文件都在同一个文件夹中,但我已经遵守了这一点。 我的python解释器是:/.conda/envs/untitled/bin/python


Tags: columns文件函数py脚本dfnew管道