File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change 1+ ``--fixtures `` now also shows fixture scope for scopes other than ``"function" ``.
Original file line number Diff line number Diff line change @@ -1342,17 +1342,19 @@ def _showfixtures_main(config, session):
13421342 currentmodule = module
13431343 if verbose <= 0 and argname [0 ] == "_" :
13441344 continue
1345+ tw .write (argname , green = True )
1346+ if fixturedef .scope != "function" :
1347+ tw .write (" [%s scope]" % fixturedef .scope , cyan = True )
13451348 if verbose > 0 :
1346- funcargspec = "%s -- %s" % (argname , bestrel )
1347- else :
1348- funcargspec = argname
1349- tw .line (funcargspec , green = True )
1349+ tw .write (" -- %s" % bestrel , yellow = True )
1350+ tw .write ("\n " )
13501351 loc = getlocation (fixturedef .func , curdir )
13511352 doc = fixturedef .func .__doc__ or ""
13521353 if doc :
13531354 write_docstring (tw , doc )
13541355 else :
13551356 tw .line (" %s: no docstring available" % (loc ,), red = True )
1357+ tw .line ()
13561358
13571359
13581360def write_docstring (tw , doc , indent = " " ):
Original file line number Diff line number Diff line change @@ -3037,11 +3037,25 @@ def test_funcarg_compat(self, testdir):
30373037
30383038 def test_show_fixtures (self , testdir ):
30393039 result = testdir .runpytest ("--fixtures" )
3040- result .stdout .fnmatch_lines (["*tmpdir*" , "*temporary directory*" ])
3040+ result .stdout .fnmatch_lines (
3041+ [
3042+ "tmpdir_factory [[]session scope[]]" ,
3043+ "*for the test session*" ,
3044+ "tmpdir" ,
3045+ "*temporary directory*" ,
3046+ ]
3047+ )
30413048
30423049 def test_show_fixtures_verbose (self , testdir ):
30433050 result = testdir .runpytest ("--fixtures" , "-v" )
3044- result .stdout .fnmatch_lines (["*tmpdir*--*tmpdir.py*" , "*temporary directory*" ])
3051+ result .stdout .fnmatch_lines (
3052+ [
3053+ "tmpdir_factory [[]session scope[]] -- *tmpdir.py*" ,
3054+ "*for the test session*" ,
3055+ "tmpdir -- *tmpdir.py*" ,
3056+ "*temporary directory*" ,
3057+ ]
3058+ )
30453059
30463060 def test_show_fixtures_testmodule (self , testdir ):
30473061 p = testdir .makepyfile (
You can’t perform that action at this time.
0 commit comments