Search code examples
python-2.7junitbddpython-3.4python-behave

Does Behave (BDD) work with Python 3.4?


I am using Behave (BDD for Python) and have been trying to enable JUnit output without success. After troubleshooting, I realized that I am getting the following error message only when using Python 3.4:

/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

When I update my project to use Python 2.7 instead, everything works fine.

Here is an important note: this is only causing trouble when I enable the JUnit output in the behave.ini config file. If I take the two lines below out of the config, everything goes fine. Unfortunately, I need to enable JUnit output for my project:

[behave]
junit=true
junit_directory=./JunitReports

If you know of any way I could make this work with Python 3.4, I'd love to know about it. Thanks in advance.


Solution

  • Looks like I answered my own question in my last comment. I just wanted to close the thread and provide an official answer as of 8/13/2014: behave is not fully supported on Python3.4, and even though most of it works fine when installed using pip3 install behave, the JUnit output option does not function.

    There is a known issue for it that has been documented here.