【发布时间】:2014-08-11 03:49:57
【问题描述】:
我正在使用Behave(Python 的 BDD)并且一直在尝试启用 JUnit 输出但没有成功。故障排除后,我意识到我在使用 Python 3.4 时收到以下错误消息only:
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 "/Users/myusername/Documents/Programming/Selenium Programming/GMail Project/GMailTests.py"
Traceback (most recent call last):
File "/Users/myusername/Documents/Programming/Selenium Programming/GMail Project/GMailTests.py", line 62, in <module>
config = Configuration()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/behave/configuration.py", line 481, in __init__
load_configuration(self.defaults, verbose=verbose)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/behave/configuration.py", line 394, in load_configuration
defaults.update(read_configuration(filename))
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/behave/configuration.py", line 348, in read_configuration
result[dest] = cfg.get('behave', dest, use_raw_value)
TypeError: get() takes 3 positional arguments but 4 were given
当我将项目更新为使用 Python 2.7 时,一切正常。
这里有一个重要说明:这只会在我在behave.ini 配置文件中启用 JUnit 输出时造成问题。如果我将下面的两行从配置中取出,一切都会好起来的。不幸的是,我需要为我的项目启用 JUnit 输出:
[behave]
junit=true
junit_directory=./JunitReports
如果您知道我可以使用 Python 3.4 进行这项工作的任何方法,我很想知道。提前致谢。
【问题讨论】:
-
当您说“仅 Python 3.4”时,您的意思是“在任何 Python 之外”,还是只是“在 Python 2.7 和 Python 3.4 之间”?
-
我只尝试过使用 Python 2.7 和 3.4,我注意到我正在尝试使用 2.7 而不是 3.4。我还没有测试过任何版本。
-
我刚刚发现这个link 似乎表明这是一个已知问题。我还没有尝试过任何提到的解决方法。
标签: python-2.7 junit bdd python-3.4 python-behave