auto-cleaning refs and updating tests for this

pull/300/head
Chris Holdgraf 2018-06-27 08:25:05 -07:00
rodzic b4374eba04
commit c035dd22d4
3 zmienionych plików z 10 dodań i 15 usunięć

Wyświetl plik

@ -176,9 +176,9 @@ class Repo2Docker(Application):
sys.exit(1)
if ref:
if len(ref.split('/')) != 2:
raise ValueError('Expected --ref to be of the form '
'remote/reference, but got %s' % ref)
if self.repo_type == "remote" and len(ref.split('/')) < 2:
# Ensure that the ref has `origin` in front
ref = '/'.join(["origin", ref])
try:
for line in execute_cmd(['git', 'reset', '--hard', ref],
cwd=checkout_path,
@ -248,8 +248,8 @@ class Repo2Docker(Application):
argparser.add_argument(
'--ref',
help=('If building a git url, which reference to check out. Must '
'be of the form `remote/reference`. E.g., `origin/master`.')
help=('If building a git url, which reference to check out. '
'E.g., `master`.')
)
argparser.add_argument(

Wyświetl plik

@ -230,13 +230,3 @@ def test_docker_no_build_success():
builddir = os.path.dirname(__file__) + '/../'
assert validate_arguments(builddir, args_list, "", True)
def test_ref_has_correct_form():
"""
Test to check if --ref is given with the form `remote/reference`
"""
builddir = os.path.dirname(__file__)
args_list = ['--no-run', '--no-build', '--ref', 'myreference']
assert not validate_arguments(builddir, args_list, 'Expected --ref to be of the form remote/reference, but got myreference')

Wyświetl plik

@ -3,3 +3,8 @@
url: https://github.com/minrk/ligo-binder/
ref: origin/b8259dac9eb
verify: python -c 'import matplotlib'
# To test that ref is added if not present
- name: LIGO Gravitational Waves
url: https://github.com/minrk/ligo-binder/
ref: b8259dac9eb
verify: python -c 'import matplotlib'