Fix the tests (#3)
* Fix the tests * Fix .format string failures on python 2.6
This commit is contained in:
parent
ee311e1eae
commit
f59d8f7720
|
@ -2541,10 +2541,10 @@ class FixtureDef:
|
||||||
if what == 'SETUP':
|
if what == 'SETUP':
|
||||||
deps = sorted(arg for arg in self.argnames if arg != 'request')
|
deps = sorted(arg for arg in self.argnames if arg != 'request')
|
||||||
if deps:
|
if deps:
|
||||||
tw.write(' (fixtures used: {})'.format(', '.join(deps)))
|
tw.write(' (fixtures used: {0})'.format(', '.join(deps)))
|
||||||
|
|
||||||
if hasattr(self, 'cached_param'):
|
if hasattr(self, 'cached_param'):
|
||||||
tw.write('[{}]'.format(self.cached_param))
|
tw.write('[{0}]'.format(self.cached_param))
|
||||||
|
|
||||||
if capman:
|
if capman:
|
||||||
capman.resumecapture()
|
capman.resumecapture()
|
||||||
|
|
|
@ -91,10 +91,10 @@ def show_test_item(item):
|
||||||
tw = item.config.get_terminal_writer()
|
tw = item.config.get_terminal_writer()
|
||||||
tw.line()
|
tw.line()
|
||||||
tw.write(' ' * 8)
|
tw.write(' ' * 8)
|
||||||
tw.write('{}'.format(item._nodeid))
|
tw.write('{0}'.format(item._nodeid))
|
||||||
used_fixtures = sorted(item._fixtureinfo.name2fixturedefs.keys())
|
used_fixtures = sorted(item._fixtureinfo.name2fixturedefs.keys())
|
||||||
if used_fixtures:
|
if used_fixtures:
|
||||||
tw.write(' (fixtures used: {})'.format(', '.join(used_fixtures)))
|
tw.write(' (fixtures used: {0})'.format(', '.join(used_fixtures)))
|
||||||
|
|
||||||
def pytest_runtest_setup(item):
|
def pytest_runtest_setup(item):
|
||||||
item.session._setupstate.prepare(item)
|
item.session._setupstate.prepare(item)
|
||||||
|
|
|
@ -16,7 +16,7 @@ def test_show_only_active_fixtures(testdir):
|
||||||
|
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
'*SETUP F arg1*',
|
'*SETUP F arg1*',
|
||||||
'*test_arg1 fixtures: arg1',
|
'*test_arg1 (fixtures used: arg1)',
|
||||||
'*TEARDOWN F arg1*',
|
'*TEARDOWN F arg1*',
|
||||||
])
|
])
|
||||||
assert "_arg0" not in result.stdout.str()
|
assert "_arg0" not in result.stdout.str()
|
||||||
|
@ -41,7 +41,7 @@ def test_show_different_scopes(testdir):
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
'SETUP S arg_session*',
|
'SETUP S arg_session*',
|
||||||
'*SETUP F arg_function*',
|
'*SETUP F arg_function*',
|
||||||
'*test_arg1 fixtures: arg_function, arg_session',
|
'*test_arg1 (fixtures used: arg_function, arg_session)',
|
||||||
'*TEARDOWN F arg_function*',
|
'*TEARDOWN F arg_function*',
|
||||||
'TEARDOWN S arg_session*',
|
'TEARDOWN S arg_session*',
|
||||||
])
|
])
|
||||||
|
@ -68,8 +68,8 @@ def test_show_nested_fixtures(testdir):
|
||||||
|
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
'SETUP S arg_same*',
|
'SETUP S arg_same*',
|
||||||
'*SETUP F arg_same*',
|
'*SETUP F arg_same (fixtures used: arg_same)*',
|
||||||
'*test_arg1 fixtures: arg_same',
|
'*test_arg1 (fixtures used: arg_same)',
|
||||||
'*TEARDOWN F arg_same*',
|
'*TEARDOWN F arg_same*',
|
||||||
'TEARDOWN S arg_same*',
|
'TEARDOWN S arg_same*',
|
||||||
])
|
])
|
||||||
|
@ -94,7 +94,7 @@ def test_show_fixtures_with_autouse(testdir):
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
'SETUP S arg_session*',
|
'SETUP S arg_session*',
|
||||||
'*SETUP F arg_function*',
|
'*SETUP F arg_function*',
|
||||||
'*test_arg1 fixtures: arg_function, arg_session',
|
'*test_arg1 (fixtures used: arg_function, arg_session)',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue