lundi 2 septembre 2019

Pytest stuck on 'collecting...'

I have a file new_script_piped.py with a function I want to test:

def columns_preparation(df):

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

    return df

and the test file test_new_script_piped.py

import pandas as pd
import new_script_piped as x

def test_columns_preparation(df):

    test_df = pd.read_excel('test_column_preparation.xlsx')
    result_df = pd.read_excel('test_column_preparation_result.xlsx')

    assert x.columns_preparation(test_df) == result_df

All files are in the same directory. I have tried on the command line:

python3 -m pytest new_script_piped.py

pytest new_script_piped.py

python -m pytest new_script_piped.py

and they all get suck at:

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

Other solutions advise to check on spelling mistakes and to make sure all files are in the same folder, but I already comply that. My python interpreter is: /.conda/envs/untitled/bin/python

Aucun commentaire:

Enregistrer un commentaire