由于跑者当前目录

时间:2017-03-28 00:04:53

标签: python pycharm pytest

刚刚安装了新版本的Pycharm 2017.1,我的所有py.test测试用例都停止了工作。做了一点挖掘,似乎以前版本的Pycharm用于从项目Test目录运行测试用例。现在Pycharm似乎从项目Root目录运行测试 - 因此测试发现无法正常工作。

其他人已经确定了相同的problem,但尚无解决方案。

我尝试在Edit Configurations中手动设置工作目录,但这不起作用。有人建议解决这个问题吗?

请注意,我以前能够右键单击测试用例,而Pycharm会让我选择只运行那个案例。现在该选项不再出现了。也许这可能与测试发现有关,因为我收到错误消息Empty test suite.

ADDED

Pycharm的错误日志。请注意,测试是从包根目录而不是../test directory

运行的
Testing started at 6:15 PM ...
Launching py.test with arguments 
test_pyugend.py::test_bokeh_sweep_plot_overall
ERROR: file not found: test_pyugend.py::test_bokeh_sweep_plot_overall
============================= test session starts 
==============================
platform linux -- Python 3.5.2, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: 


/media/krishnab/jaimini/development/gender_equity/
university_gender_dynamics/py_package_ugend, inifile: 

========================= no tests ran in 0.00 seconds 
=========================

Process finished with exit code 0
Empty test suite.

我的Pycharm版本信息是:

PyCharm 2017.1
Build #PY-171.3780.115, built on March 24, 2017
Licensed to shrikrishna bhogaonker
Subscription is active until January 13, 2018
For educational use only.
JRE: 1.8.0_112-release-736-b13 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-59-generic 

此图片中捕获的运行配置。 enter image description here

1 个答案:

答案 0 :(得分:1)

有相同的情况。更新了pycharm到版本2017.1.2.it现在对我有用。

PyCharm 2017.1.2 构建#PY-171.4249.47 JRE:1.8.0_112-release-736-b21 x86_64 Mac OS X 10.11.4

https://confluence.jetbrains.com/display/PYH/PyCharm+171.4249.47+Release+Notes?fromIDE