[英]Python trying to run behave get errors
我试图使用行为来运行硒测试,但我一直陷于这一想法的开始。 我已经设置了python,selenium并按照应有的方式运行。 我用硒运行python脚本没有问题。 当我尝试以行为方式运行它们时,我的问题开始了。 我的python是3.5.2,硒是2.53.2,行为是1.2.5。 当我尝试运行任何功能文件时,出现以下错误。 无论是尝试使用PyCharm IDE还是直接在命令提示符下运行它,都没有关系。 有谁知道是哪里错还是我做错了什么?
错误:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 269, in <module>
_BehaveRunner(my_config, base_dir).run()
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\_bdd_utils.py", line 92, in run
number_of_tests = self._get_number_of_tests()
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\_bdd_utils.py", line 206, in _get_number_of_tests
for feature in self._get_features_to_run():
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 209, in _get_features_to_run
self.__real_runner.run()
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 672, in run
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 677, in run_with_paths
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 92, in load_hooks
super(_RunnerWrapper, self).load_hooks(filename)
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 631, in load_hooks
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 303, in exec_file
File "features\environment.py", line 11
print("Before scenario\n")
^
IndentationError: unindent does not match any outer indentation level
流程以退出代码1完成
您的回溯将返回:'IndentationError:unindent与任何外部缩进级别都不匹配'。
这通常表明您的缩进级别的制表符/空格不正确。
您可以尝试将制表符重新格式化为4个空格吗?
正如khelwood指出的那样,您应该查看的文件是第11行附近的“ features \\ environment.py”。
这通常应该解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.