Ejemplo n.º 1
0
def test_shallow_clone():
    with TemporaryDirectory() as tmpdir:
        archive_filename = resource_filename(__name__, 'data/test_repository.tar')
        unpack_archive(archive_filename, tmpdir)

        with shallow_clone(os.path.join(tmpdir, 'test_repository')) as working_copy_path:
            assert 'known_file' in os.listdir(working_copy_path)
            with open(os.path.join(working_copy_path, 'known_file')) as known_file:
                assert known_file.read() == 'Hello, World!\n'
Ejemplo n.º 2
0
def check_repo(github, repo_name):
    logger.info('Checking %s/%s', github.owner, repo_name)

    checkout_url = github.get_checkout_url(repo_name)

    with shallow_clone(checkout_url) as working_copy:
        with push_working_directory(working_copy):
            try:
                return check_call(['nsp', 'check'])
            except CalledProcessError as e:
                logger.error("nsp check returned non-zero exit status, see log for details")