python3:Intellij中用于Windows中pytest的虚拟环境-终端不扣除unitTest

时间:2018-08-17 17:13:02

标签: python-3.x pytest

问题是pytest -v没有扣除测试用例。为什么?

我在C:\ Users \ aavik \ AppData \ Local \ Programs \ Python \ Python36下安装了Python3,并在环境变量中设置了PYTHONPATH。

a)我在Intellij Terminal中运行:

set http_proxy=http://username:passwrd@server:port
set https_proxy=https://username:passwrd@server:port
pip install virtualenv
pip install pytest
python -m venv pytest-venv_aavik
pytest --version

虚拟环境创建创建了pytest-venv_aavik文件夹,其中包含以下子目录:  1.包含  2.库  3.脚本  4. pyvenv.cfg文件

pytest -v 
collected 0 items
rootdir: c:\Users\aavik\IdeaProjects\common\src\test\unitTest

文件夹结构为: common \ src \ main \ pythonlib \ sample1.py common \ src \ test \ unitTest \ TestAssetTrue.py: def test_assertTrue():    断言为真

b)在

Settings -> Python Integrated Tools -> Default test runner: py-test
Project Structure -> SDKs -> common -> create virtual env -> python3_venv_aavik    
Edit configurations -> Python tests -> sample1_unitTest
selected: 
Path: c:/Users/aavik/IdeaProjects/common/src/test/unitTest/TestAssetTrue.py 
Python Interpretor: Python 3.6.5 virtualenv at  (C:\Users\aavik\python3_venv_aavik)
Selected both contents roots and source roots to PYTHONPATH.

运行sample1_unitTest,效果很好。

终端为什么检测到unitTest?

谢谢。

0 个答案:

没有答案