pytest報錯Hint: make sure your test modules/packages have valid Python names.

QIQI_DS發表於2020-11-24
___ ERROR collecting tests/transformers/statistics/test_histogram_sklearn.py ___
ImportError while importing test module '/data/home/gitlab_runner/_Go_1xWz/0/bkdata/datamining/datamodelinggroup/aiopsscenes/datamodeling_extra-nova/tests/transformers/statistics/test_histogram_sklearn.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/python3/lib/python3.6/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'tests.transformers'
____ ERROR collecting tests/transformers/statistics/test_histogram_spark.py ____
ImportError while importing test module '/data/home/gitlab_runner/_Go_1xWz/0/bkdata/datamining/datamodelinggroup/aiopsscenes/datamodeling_extra-nova/tests/transformers/statistics/test_histogram_spark.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/python3/lib/python3.6/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'tests.transformers'

排查發現是一個test檔案沒有放在test資料夾中導致的,不是網上說的__init__檔案的問題

相關文章