Skip to content

Commit

Permalink
WIP: python3 support - gabrielfalcao#458
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas committed Dec 11, 2015
1 parent c2bcc4a commit c2c24cd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 27 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: python
sudo: false
python:
- "2.7"
# command to install dependencies
- "3.4"
- "3.5"
install:
- pip install -r requirements.txt
# Deal with issue on Travis builders re: multiprocessing.Queue :(
- "sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm"
# command to run tests
script: make unit functional
script:
- make unit functional
12 changes: 6 additions & 6 deletions lettuce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def run(self):
try:
self.loader.find_and_load_step_definitions()
except StepLoadingError as e:
print "Error loading step definitions:\n", e
print("Error loading step definitions:\n", e)
return

call_hook('before', 'all')
Expand All @@ -189,18 +189,18 @@ def run(self):
except exceptions.LettuceSyntaxError as e:
sys.stderr.write(e.msg)
failed = True
except exceptions.NoDefinitionFound, e:
except (exceptions.NoDefinitionFound, e):
sys.stderr.write(e.msg)
failed = True
except:
if not self.failfast:
e = sys.exc_info()[1]
print "Died with %s" % str(e)
print("Died with %s" % str(e))
traceback.print_exc()
else:
print
print ("Lettuce aborted running any more tests "
"because was called with the `--failfast` option")
print('')
print("Lettuce aborted running any more tests "
"because was called with the `--failfast` option")

failed = True

Expand Down
2 changes: 1 addition & 1 deletion lettuce/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ def run(self, ignore_case):
try:
results.append(step.run(ignore_case))
except Exception as e:
print e
print(e)
pass

call_hook('after_each', 'step', step)
Expand Down
8 changes: 4 additions & 4 deletions lettuce/django/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def start(self):
if getattr(settings, 'LETTUCE_SERVE_ADMIN_MEDIA', False):
msg += ' (as per settings.LETTUCE_SERVE_ADMIN_MEDIA=True)'

print "%s..." % msg
print("%s..." % msg)

self._server.start()
self._server.wait()
Expand All @@ -306,7 +306,7 @@ def start(self):
'python manage.py --no-server' % addrport,
)

print "Django's builtin server is running at %s:%d" % addrport
print("Django's builtin server is running at %s:%d" % addrport)

def stop(self, fail=False):
pid = self._server.pid
Expand Down Expand Up @@ -349,9 +349,9 @@ def start(self):
port=self.port)
LiveServerTestCase.setUpClass()

print "Django's builtin server is running at {address}:{port}".format(
print("Django's builtin server is running at {address}:{port}".format(
address=self.address,
port=self.port)
port=self.port))

def stop(self, fail=False):
LiveServerTestCase.tearDownClass()
Expand Down
14 changes: 7 additions & 7 deletions lettuce/django/steps/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,20 +183,20 @@ def _dump_model(model, attrs=None):
"""

for field in model._meta.fields:
print '%s=%s,' % (field.name, str(getattr(model, field.name))),
print('%s=%s,' % (field.name, str(getattr(model, field.name)))),

if attrs is not None:
for attr in attrs:
print '%s=%s,' % (attr, str(getattr(model, attr))),
print('%s=%s,' % (attr, str(getattr(model, attr)))),

for field in model._meta.many_to_many:
vals = getattr(model, field.name)
print '%s=%s (%i),' % (
print('%s=%s (%i),' % (
field.name,
', '.join(map(str, vals.all())),
vals.count()),
vals.count())),

print
print('')


def models_exist(model, data, queryset=None):
Expand Down Expand Up @@ -237,11 +237,11 @@ def models_exist(model, data, queryset=None):
model.__name__, hash_, filtered.query)

except AssertionError as exc:
print exc
print(exc)
failed += 1

if failed:
print "Rows in DB are:"
print("Rows in DB are:")
for model in queryset.all():
_dump_model(model, extra_attrs.keys())

Expand Down
4 changes: 2 additions & 2 deletions lettuce/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ def call_hook(situation, kind, *args, **kw):
try:
callback(*args, **kw)
except Exception as e:
print "=" * 1000
print("=" * 1000)
traceback.print_exc(e)
print
print('')
raise


Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ python-subunit==1.2.0
sure==1.2.24
tornado==4.3
tox==2.3.0
markment==0.2.21
steadymark==0.6.0
testtools==1.8.1

0 comments on commit c2c24cd

Please sign in to comment.