@pytest.mark.parametrize('args', [['dir1', 'dir2', '-v'], ['dir1', '-v', 'dir2'], ['dir2', '-v', 'dir1'], ['-v', 'dir2', 'dir1']])
def test_consider_args_after_options_for_rootdir_and_inifile(testdir, args):
 root = testdir.tmpdir.mkdir('myroot')
 d1 = root.mkdir('dir1')
 d2 = root.mkdir('dir2')
 for (i, arg) in enumerate(args):
  if (arg == 'dir1'):
   args[i] = d1
  elif (arg == 'dir2'):
   args[i] = d2
 with root.as_cwd():
  result = testdir.runpytest(*args)
 result.stdout.fnmatch_lines(['*rootdir: *myroot, inifile: '])

@ pytest . mark . parametrize ( 'args' , [ [ 'dir1' , 'dir2' , '-v' ] , [ 'dir1' , '-v' , 'dir2' ] , [ 'dir2' , '-v' , 'dir1' ] , [ '-v' , 'dir2' , 'dir1' ] ] ) def test_consider_args_after_options_for_rootdir_and_inifile ( testdir , args ) : root = testdir . tmpdir . mkdir ( 'myroot' ) d1 = root . mkdir ( 'dir1' ) d2 = root . mkdir ( 'dir2' ) for ( i , arg ) in enumerate ( args ) : if ( arg == 'dir1' ) : args [ i ] = d1 elif ( arg == 'dir2' ) : args [ i ] = d2 with root . as_cwd ( ) : result = testdir . runpytest ( * args ) result . stdout . fnmatch_lines ( [ '*rootdir: *myroot, inifile: ' ] )
consider all arguments in the command-line for rootdir and inifile discovery .