kopia lustrzana https://github.com/jupyterhub/repo2docker
auto-cleaning refs and updating tests for this
rodzic
b4374eba04
commit
c035dd22d4
|
@ -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(
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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'
|
||||
|
|
Ładowanie…
Reference in New Issue