@pytest.fixture(scope='function')
def collection(tmpdir, request):
    if request.param:
        test_name = request.param
    else:
        test_name = request.node.name
    filepath = request.module.__file__
    (test_dir, f) = os.path.split(filepath)
    resources = os.path.join(test_dir, 'resources')
    resources_collection = os.path.join(resources, (test_name + '_collection.json'))
    resources_validation = os.path.join(resources, 'validation', (test_name + '_library.py'))
    copyfile(resources_collection, os.path.join(tmpdir, 'collection.json'))
    copyfile(resources_validation, os.path.join(tmpdir, 'validation_library.py'))
    old_cwd = os.getcwd()
    os.chdir(tmpdir)
    library = tmpdir.join('./postman_libraries/newmanTest.py')
    library_validation = tmpdir.join('./validation_library.py')
    (yield {'generated': library, 'expected': library_validation})
    os.chdir(old_cwd)
@pytest.fixture(scope='function')
def collection(tmpdir, request):
    if request.param:
        test_name = request.param
    else:
        test_name = request.node.name
    filepath = request.module.__file__
    (test_dir, f) = os.path.split(filepath)
    resources = os.path.join(test_dir, 'resources')
    resources_collection = os.path.join(resources, (test_name + '_collection.json'))
    resources_validation = os.path.join(resources, 'validation', (test_name + '_library.py'))
    copyfile(resources_collection, os.path.join(tmpdir, 'collection.json'))
    copyfile(resources_validation, os.path.join(tmpdir, 'validation_library.py'))
    old_cwd = os.getcwd()
    os.chdir(tmpdir)
    library = tmpdir.join('./postman_libraries/newmanTest.py')
    library_validation = tmpdir.join('./validation_library.py')
    (yield {'generated': library, 'expected': library_validation})
    os.chdir(old_cwd)