def test_push_working_directory(): original_directory = os.getcwd() with TemporaryDirectory() as new_cwd: with push_working_directory(new_cwd): assert os.path.realpath(os.getcwd()) == os.path.realpath(new_cwd) assert os.path.realpath(os.getcwd()) == os.path.realpath(original_directory)
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")