cd before package installation

(cherry picked from commit ca7ffff07b)
This commit is contained in:
Brad Warren 2019-05-01 17:24:21 -07:00
parent 7d28480844
commit 55dabca684

View file

@ -36,22 +36,24 @@ def main(args):
else:
new_args.append(arg)
for requirement in new_args:
current_command = command[:]
current_command.append(requirement)
call_with_print(' '.join(current_command))
pkg = re.sub(r'\[\w+\]', '', requirement)
if pkg == '.':
pkg = 'certbot'
temp_cwd = tempfile.mkdtemp()
# We use a temporary directory during both installation and testing to
# avoid other files in the repo from impacting tests.
temp_cwd = tempfile.mkdtemp()
try:
shutil.copy2("pytest.ini", temp_cwd)
try:
for requirement in new_args:
current_command = command[:]
current_command.append(os.path.abspath(requirement))
call_with_print(' '.join(current_command), cwd=temp_cwd)
pkg = re.sub(r'\[\w+\]', '', requirement)
if pkg == '.':
pkg = 'certbot'
call_with_print(' '.join([
sys.executable, '-m', 'pytest', '--pyargs', pkg.replace('-', '_')]), cwd=temp_cwd)
finally:
shutil.rmtree(temp_cwd)
finally:
shutil.rmtree(temp_cwd)
if __name__ == '__main__':
main(sys.argv[1:])