Permalink
Browse files

all tests passing

  • Loading branch information...
1 parent 9247393 commit ffbd1fff677d01dd028404cc9555f9684b60ebf4 @spulec committed Feb 11, 2013
View
@@ -3,7 +3,8 @@
./tests/functional/2nd_feature_dir/step_definitions/__init__.py
docs/_build/
docs/_build
-lettuce.egg-info/
+*.egg
+*.egg-info/
build/
dist/
.DS_Store
View
@@ -1 +1,2 @@
include COPYING *.md
+include requirements.txt
View
@@ -65,7 +65,7 @@
try:
terrain = fs.FileSystem._import("terrain")
reload(terrain)
-except Exception, e:
+except Exception as e:
if not "No module named terrain" in str(e):
string = 'Lettuce has tried to load the conventional environment ' \
'module "terrain"\nbut it has errors, check its contents and ' \
@@ -129,8 +129,8 @@ def run(self):
started_at = datetime.now()
try:
self.loader.find_and_load_step_definitions()
- except StepLoadingError, e:
- print "Error loading step definitions:\n", e
+ except StepLoadingError as e:
+ print("Error loading step definitions:\n", e)
return
call_hook('before', 'all')
@@ -154,12 +154,12 @@ def run(self):
results.append(
feature.run(self.scenarios, tags=self.tags, random=self.random))
- except exceptions.LettuceSyntaxError, e:
+ except exceptions.LettuceSyntaxError as e:
sys.stderr.write(e.msg)
failed = True
except:
e = sys.exc_info()[1]
- print "Died with %s" % str(e)
+ print("Died with %s" % str(e))
traceback.print_exc()
failed = True
@@ -178,10 +178,10 @@ def run(self):
minutes = time_took.seconds / 60
seconds = time_took.seconds
if hours:
- print "(finished within %d hours)" % hours
+ print ("(finished within %d hours)" % hours)
elif minutes:
- print "(finished within %d minutes)" % minutes
+ print("(finished within %d minutes)" % minutes)
elif seconds:
- print "(finished within %d seconds)" % seconds
+ print("(finished within %d seconds)" % seconds)
return total
View
@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
+from __future__ import unicode_literals
import re
import codecs
@@ -39,16 +39,16 @@
class REP(object):
"RegEx Pattern"
- first_of = re.compile(ur'^first_of_')
- last_of = re.compile(ur'^last_of_')
+ first_of = re.compile(r'^first_of_')
+ last_of = re.compile(r'^last_of_')
language = re.compile(u"language:[ ]*([^\s]+)")
within_double_quotes = re.compile(r'("[^"]+")')
within_single_quotes = re.compile(r"('[^']+')")
only_whitespace = re.compile('^\s*$')
tag_extraction_regex = re.compile(r'(?:(?:^|\s+)[@]([^@\s]+))')
- tag_strip_regex = re.compile(ur'(?:(?:^\s*|\s+)[@]\S+\s*)+$', re.DOTALL)
- comment_strip1 = re.compile(ur'(^[^\'"]*)[#]([^\'"]*)$')
- comment_strip2 = re.compile(ur'(^[^\'"]+)[#](.*)$')
+ tag_strip_regex = re.compile(r'(?:(?:^\s*|\s+)[@]\S+\s*)+$', re.DOTALL)
+ comment_strip1 = re.compile(r'(^[^\'"]*)[#]([^\'"]*)$')
+ comment_strip2 = re.compile(r'(^[^\'"]+)[#](.*)$')
class HashList(list):
@@ -142,7 +142,7 @@ def __call__(self, *args, **kw):
try:
ret = self.function(self.step, *args, **kw)
self.step.passed = True
- except Exception, e:
+ except Exception as e:
self.step.failed = True
self.step.why = ReasonToFail(self.step, e)
raise
@@ -456,10 +456,10 @@ def run_all(steps, outline=None, run_callbacks=False, ignore_case=True):
step.run(ignore_case)
steps_passed.append(step)
- except NoDefinitionFound, e:
+ except NoDefinitionFound as e:
steps_undefined.append(e.step)
- except Exception, e:
+ except Exception as e:
steps_failed.append(step)
reasons_to_fail.append(step.why)
@@ -728,7 +728,7 @@ def _add_myself_to_steps(self):
step.scenario = self
def _find_tags_in(self, original_string):
- broad_regex = re.compile(ur"([@].*)%s: (%s)" % (
+ broad_regex = re.compile(r"([@].*)%s: (%s)" % (
self.language.scenario_separator,
self.name), re.DOTALL)
@@ -737,7 +737,7 @@ def _find_tags_in(self, original_string):
regexes.append(broad_regex)
else:
- regexes.append(re.compile(ur"(?:%s: %s.*)([@]?.*)%s: (%s)\s*\n" % (
+ regexes.append(re.compile(r"(?:%s: %s.*)([@]?.*)%s: (%s)\s*\n" % (
self.language.non_capturable_scenario_separator,
self.previous_scenario.name,
self.language.scenario_separator,
@@ -885,8 +885,8 @@ def run(self, ignore_case):
call_hook('before_each', 'step', step)
try:
results.append(step.run(ignore_case))
- except Exception, e:
- print e
+ except Exception as e:
+ print(e)
pass
call_hook('after_each', 'step', step)
@@ -1089,7 +1089,7 @@ def _parse_remaining_lines(self, lines, original_string, with_file=None):
# replacing occurrences of Scenario Outline, with just "Scenario"
scenario_prefix = u'%s:' % self.language.first_of_scenario
regex = re.compile(
- ur"%s:[\t\r\f\v]*" % self.language.scenario_separator, re.U | re.I | re.DOTALL)
+ r"%s:[\t\r\f\v]*" % self.language.scenario_separator, re.U | re.I | re.DOTALL)
joined = regex.sub(scenario_prefix, joined)
View
@@ -39,7 +39,7 @@ def step(regex):
def wrap(func):
try:
re.compile(regex)
- except re.error, e:
+ except re.error as e:
raise StepLoadingError("Error when trying to compile:\n"
" regex: %r\n"
" for function: %s\n"
@@ -107,7 +107,7 @@ def handle(self, *args, **options):
if run_server:
try:
server.start()
- except LettuceServerException, e:
+ except LettuceServerException as e:
raise SystemExit(e)
os.environ['SERVER_NAME'] = server.address
@@ -138,10 +138,10 @@ def handle(self, *args, **options):
results.append(result)
if not result or result.steps != result.steps_passed:
failed = True
- except SystemExit, e:
+ except SystemExit as e:
failed = e.code
- except Exception, e:
+ except Exception as e:
failed = True
import traceback
traceback.print_exc(e)
View
@@ -227,7 +227,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._actual_server.start()
self._actual_server.wait()
@@ -242,7 +242,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._actual_server.pid
View
@@ -40,7 +40,7 @@ def find_and_load_step_definitions(self):
to_load = FileSystem.filename(filename, with_extension=False)
try:
module = __import__(to_load)
- except ValueError, e:
+ except ValueError as e:
import traceback
err_msg = traceback.format_exc(e)
if 'empty module name' in err_msg.lower():
@@ -136,7 +136,7 @@ def mkdir(cls, path):
"""
try:
os.makedirs(path)
- except OSError, e:
+ except OSError as e:
# ignore if path already exists
if e.errno not in (17, ):
raise e
View
@@ -86,10 +86,10 @@ def call_hook(situation, kind, *args, **kw):
for callback in CALLBACK_REGISTRY[kind][situation]:
try:
callback(*args, **kw)
- except Exception, e:
- print "=" * 1000
+ except Exception as e:
+ print("=" * 1000)
traceback.print_exc(e)
- print
+ print()
raise
View
@@ -4,14 +4,13 @@ Pygments==1.5
Sphinx==1.1.3
coverage==3.5.2
cssselect==0.7.1
-distribute==0.6.32
+distribute==0.6.31
docutils==0.9.1
fuzzywuzzy==0.1
lxml
mock==1.0b1
mox==0.5.3
nose==1.1.2
-#sure==1.0.6
-https://github.com/gabrielfalcao/sure/tarball/7d51e447e86b5beee11638c10a9d93f6f032d4e5
+sure==1.1.7
tornado==2.3
tox==1.4.2
View
@@ -22,7 +22,7 @@
def get_packages():
# setuptools can't do the job :(
- packages = []
+ packages = ['']
for root, dirnames, filenames in os.walk('lettuce'):
if '__init__.py' in filenames:
packages.append(".".join(os.path.split(root)).strip("."))
@@ -37,6 +37,13 @@ def get_packages():
if os.name.lower() == 'nt':
required_modules.append('colorama')
+import os
+test_reqs = os.path.join(os.getcwd(), 'requirements.txt')
+tests_require = [
+ line.strip() for line in open(test_reqs).readlines()
+ if not line.startswith("#")
+ ]
+
setup(
name='lettuce',
version='0.2.12',
@@ -46,13 +53,11 @@ def get_packages():
url='http://lettuce.it',
packages=get_packages(),
install_requires=required_modules,
+ tests_require=tests_require,
entry_points={
'console_scripts': ['lettuce = lettuce.bin:main'],
},
package_data={
'lettuce': ['COPYING', '*.md'],
},
- dependency_links=[
- "git+git://github.com/spulec/sure.git@py3k#egg=sure"
- ],
)
@@ -16,17 +16,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import commands
+import sys
from os.path import dirname, abspath, join, curdir
from nose.tools import assert_equals, with_setup
from tests.asserts import prepare_stdout
+PY3 = sys.version_info[0] == 3
+
+
def test_imports_terrain_under_path_that_is_run():
old_path = abspath(curdir)
os.chdir(join(abspath(dirname(__file__)), 'simple_features', '1st_feature_dir'))
- status, output = commands.getstatusoutput('python -c "from lettuce import world;assert hasattr(world, \'works_fine\'); print \'it passed!\'"')
+
+ py_command = 'python3' if PY3 else 'python2'
+ status, output = commands.getstatusoutput('{} -c "from lettuce import world;assert hasattr(world, \'works_fine\'); print \'it passed!\'"'.format(py_command))
assert_equals(status, 0)
assert_equals(output, "it passed!")
View
@@ -4,9 +4,9 @@
# and then run "tox" from this directory.
[tox]
-envlist = py26, py27
+envlist = py26, py27, py33
[testenv]
commands =
- pip install --use-mirrors -q -r requirements.txt
+ python setup.py test
make unit functional

0 comments on commit ffbd1ff

Please sign in to comment.