Pytest未能收集测试

2024-06-17 09:30:29 发布

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

Pytest停止收集测试,它会自发地发生,一个测试通过,另一个运行只是表明没有运行测试

├── __init__.py
├── pytestdebug.log
├── readme.md
├── requirements.txt
├── setup.py
├── task
│   ├── cli.py
│   ├── __init__.py
│   ├── __pycache__
│   └── task_cm.py
├── test
│   ├── __init__.py
│   ├── __pycache__
│   └── task_cm_task.py
└─$ python3 -m pytest
=================================================================================
test session starts 
==================================================================================
platform linux -- Python 3.9.1+, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/mbienias/skygate
collected 0 items                                                                                                                                                                      

================================================================================ 
no tests ran in 0.01s 
=================================================================================
└─$ python3 -m pytest --collect-only
================================================================================= 
test session starts 
==================================================================================
platform linux -- Python 3.9.1+, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/mbienias/skygate
collected 0 items                                                                                                                                                                      

============================================================================= 
no tests collected in 0.01s
=============================================================================

但是,它可以看到已定义的夹具

-------------------------------------------------------------------------- 
fixtures defined from test_task_cm
--------------------------------------------------------------------------
setup_database
    test/test_task_cm.py:8: no docstring available

编辑:链接到debug.logPastebin.com


Tags: nopytesttaskinitpytestsessionlinux