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.
Changing the first line in the
script: /usr/local/bin/behave
to: #!/usr/local/bin/python3 #you might want to run which python3
resolved the issue
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With