kopia lustrzana https://github.com/jupyterhub/repo2docker
Add test for cleanup_checkout
rodzic
a44aed7664
commit
183d504515
|
@ -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:
|
||||
|
|
|
@ -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
|
Ładowanie…
Reference in New Issue