Skip to content

Commit ee311e1

Browse files
authored
Merge pull request #2 from kvas-it/features
Add printing of fixture dependencies
2 parents 2c6cfa4 + 2c5c4f3 commit ee311e1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

_pytest/python.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2537,6 +2537,12 @@ def _log_fixture_stack(self, what):
25372537
step=what.ljust(8), # align the output to TEARDOWN
25382538
scope=self.scope[0].upper(),
25392539
fixture=self.argname))
2540+
2541+
if what == 'SETUP':
2542+
deps = sorted(arg for arg in self.argnames if arg != 'request')
2543+
if deps:
2544+
tw.write(' (fixtures used: {})'.format(', '.join(deps)))
2545+
25402546
if hasattr(self, 'cached_param'):
25412547
tw.write('[{}]'.format(self.cached_param))
25422548

_pytest/runner.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,10 @@ def show_test_item(item):
9191
tw = item.config.get_terminal_writer()
9292
tw.line()
9393
tw.write(' ' * 8)
94-
tw.write('{} '.format(item._nodeid))
94+
tw.write('{}'.format(item._nodeid))
9595
used_fixtures = sorted(item._fixtureinfo.name2fixturedefs.keys())
9696
if used_fixtures:
97-
tw.write('fixtures: ')
98-
tw.write(', '.join(used_fixtures))
97+
tw.write(' (fixtures used: {})'.format(', '.join(used_fixtures)))
9998

10099
def pytest_runtest_setup(item):
101100
item.session._setupstate.prepare(item)

0 commit comments

Comments
 (0)