@@ -125,7 +125,10 @@ class fixture_ref(object): # noqa
125125 __slots__ = 'fixture' ,
126126
127127 def __init__ (self , fixture ):
128- self .fixture = fixture
128+ self .fixture = get_fixture_name (fixture )
129+
130+ def __repr__ (self ):
131+ return "fixture_ref<%s>" % self .fixture
129132
130133
131134# Fix for https://github.com/smarie/python-pytest-cases/issues/71
@@ -379,8 +382,14 @@ def _parametrize_plus(argnames=None,
379382
380383 if idgen is AUTO :
381384 # note: we use a "trick" here with mini_idval to get the appropriate result
382- # TODO support fixture_ref in mini_idval or add __name__ and str() in fixture_ref
383- idgen = lambda ** args : "-" .join ("%s=%s" % (n , mini_idval (val = v , argname = '' , idx = v )) for n , v in args .items ())
385+ def _make_ids (** args ):
386+ for n , v in args .items ():
387+ if isinstance (v , fixture_ref ):
388+ yield "%s_is_%s" % (n , v .fixture )
389+ else :
390+ yield "%s=%s" % (n , mini_idval (val = v , argname = '' , idx = v ))
391+
392+ idgen = lambda ** args : "-" .join (_make_ids (** args ))
384393
385394 # first handle argnames / argvalues (new modes of input)
386395 argnames , argvalues = _get_argnames_argvalues (argnames , argvalues , ** args )
@@ -533,7 +542,7 @@ def _create_params_alt(test_func_name, union_name, from_i, to_i, hook): # noqa
533542
534543 def _create_fixture_ref_alt (union_name , i ): # noqa
535544 # Get the referenced fixture name
536- f_fix_name = get_fixture_name ( argvalues [i ].fixture )
545+ f_fix_name = argvalues [i ].fixture
537546
538547 if debug :
539548 print ("Creating reference to fixture %r" % (f_fix_name ,))
0 commit comments