I am trying to use lettuce to write some simple Unit tests.
(More specifically I am following this tutorial: https://semaphoreci.com/community/tutorials/bdd-testing-a-restful-web-application-in-python)
I just installed lettuce with:
$ pip3 install lettuce
and when I run
$ lettuce test/features
I get:
Traceback (most recent call last):
File "/usr/local/bin/lettuce", line 9, in <module>
load_entry_point('lettuce==0.2.23', 'console_scripts', 'lettuce')()
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2569, in load_entry_point
return ep.load()
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2229, in load
return self.resolve()
File "/usr/local/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2235, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python3.4/site-packages/lettuce/__init__.py", line 179
print "Error loading step definitions:\n", e
^
SyntaxError: Missing parentheses in call to 'print'
Is there a mistake in the lettuce package? I went and corrected a few things(added parenthesis to some print statements and then some other prints failed for the same reason). Any ideas?
Unfortunately for you, lettuce
is not compatible with Python 3.
The project doesn't state anywhere what they are compatible with, but their source code is using Python 2 specific statements, like the print
statement that triggered the exception. There are however more problems than just that print
. There is an issue open asking for Python 3 support.
If you must use lettuce
then you'll need to use Python 2.7 instead. Otherwise, there appears to be a fork called aloe
that works with nose
and Python 3.
There is now a fork of lettuce that seems to work on Python 3.
See also the github discussion.
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