File tree 3 files changed +23
-6
lines changed
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):
1342
1342
currentmodule = module
1343
1343
if verbose <= 0 and argname [0 ] == "_" :
1344
1344
continue
1345
+ tw .write (argname , green = True )
1346
+ if fixturedef .scope != "function" :
1347
+ tw .write (" [%s scope]" % fixturedef .scope , cyan = True )
1345
1348
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 " )
1350
1351
loc = getlocation (fixturedef .func , curdir )
1351
1352
doc = fixturedef .func .__doc__ or ""
1352
1353
if doc :
1353
1354
write_docstring (tw , doc )
1354
1355
else :
1355
1356
tw .line (" %s: no docstring available" % (loc ,), red = True )
1357
+ tw .line ()
1356
1358
1357
1359
1358
1360
def 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):
3037
3037
3038
3038
def test_show_fixtures (self , testdir ):
3039
3039
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
+ )
3041
3048
3042
3049
def test_show_fixtures_verbose (self , testdir ):
3043
3050
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
+ )
3045
3059
3046
3060
def test_show_fixtures_testmodule (self , testdir ):
3047
3061
p = testdir .makepyfile (
You can’t perform that action at this time.
0 commit comments