Merge pull request #2 from kvas-it/features
Add printing of fixture dependencies
This commit is contained in:
commit
ee311e1eae
|
@ -2537,6 +2537,12 @@ class FixtureDef:
|
||||||
step=what.ljust(8), # align the output to TEARDOWN
|
step=what.ljust(8), # align the output to TEARDOWN
|
||||||
scope=self.scope[0].upper(),
|
scope=self.scope[0].upper(),
|
||||||
fixture=self.argname))
|
fixture=self.argname))
|
||||||
|
|
||||||
|
if what == 'SETUP':
|
||||||
|
deps = sorted(arg for arg in self.argnames if arg != 'request')
|
||||||
|
if deps:
|
||||||
|
tw.write(' (fixtures used: {})'.format(', '.join(deps)))
|
||||||
|
|
||||||
if hasattr(self, 'cached_param'):
|
if hasattr(self, 'cached_param'):
|
||||||
tw.write('[{}]'.format(self.cached_param))
|
tw.write('[{}]'.format(self.cached_param))
|
||||||
|
|
||||||
|
|
|
@ -91,11 +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('{}'.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: ')
|
tw.write(' (fixtures used: {})'.format(', '.join(used_fixtures)))
|
||||||
tw.write(', '.join(used_fixtures))
|
|
||||||
|
|
||||||
def pytest_runtest_setup(item):
|
def pytest_runtest_setup(item):
|
||||||
item.session._setupstate.prepare(item)
|
item.session._setupstate.prepare(item)
|
||||||
|
|
Loading…
Reference in New Issue