Add test for cleanup_checkout

pull/496/head
yuvipanda 2018-12-13 10:03:55 -08:00
rodzic a44aed7664
commit 183d504515
2 zmienionych plików z 17 dodań i 1 usunięć

Wyświetl plik

@ -306,6 +306,7 @@ def make_r2d(argv=None):
r2d.environment = args.environment
# if the source exists locally we don't want to delete it at the end
# FIXME: Find a better way to figure out if repo is 'local'. Push this into ContentProvider?
if os.path.exists(args.repo):
r2d.cleanup_checkout = False
else:

Wyświetl plik

@ -61,4 +61,19 @@ def test_run_required():
# Can't publish any ports while running if we don't specify a command explicitly
with pytest.raises(SystemExit):
make_r2d(['-p', '8000:8000', '.'])
make_r2d(['-p', '8000:8000', '.'])
def test_clean():
"""
Test checkout is cleaned appropriately
"""
# Don't clean when repo isn't local and we explicitly ask it to not clean
assert not make_r2d(['--no-clean', 'https://github.com/blah.git']).cleanup_checkout
# Do clean repo when repo isn't localj
assert make_r2d(['https://github.com/blah.git']).cleanup_checkout
# Don't clean by default when repo exists locally
assert not make_r2d(['.']).cleanup_checkout
# Don't clean when repo exists locally and we explicitly ask it to not clean
assert not make_r2d(['--no-clean', '.']).cleanup_checkout