@pytest.mark.parametrize('create_file, create_dir, filterfunc, expected', [(True, False, os.path.isfile, True), (True, False, os.path.isdir, False), (False, True, os.path.isfile, False), (False, True, os.path.isdir, True), (False, False, os.path.isfile, False), (False, False, os.path.isdir, False)])
def test_get_file_list(tmpdir, create_file, create_dir, filterfunc, expected):
 path = (tmpdir / 'foo')
 if (create_file or create_dir):
  path.ensure(dir=create_dir)
 all_files = os.listdir(str(tmpdir))
 result = filescheme.get_file_list(str(tmpdir), all_files, filterfunc)
 item = {'name': 'foo', 'absname': str(path)}
 assert ((item in result) == expected)

@ pytest . mark . parametrize ( 'create_file, create_dir, filterfunc, expected' , [ ( True , False , os . path . isfile , True ) , ( True , False , os . path . isdir , False ) , ( False , True , os . path . isfile , False ) , ( False , True , os . path . isdir , True ) , ( False , False , os . path . isfile , False ) , ( False , False , os . path . isdir , False ) ] ) def test_get_file_list ( tmpdir , create_file , create_dir , filterfunc , expected ) : path = ( tmpdir / 'foo' ) if ( create_file or create_dir ) : path . ensure ( dir = create_dir ) all_files = os . listdir ( str ( tmpdir ) ) result = filescheme . get_file_list ( str ( tmpdir ) , all_files , filterfunc ) item = { 'name' : 'foo' , 'absname' : str ( path ) } assert ( ( item in result ) == expected )
test get_file_list .