Skip to content

Commit

Permalink
fix: add test specific arg for jina hub new
Browse files Browse the repository at this point in the history
  • Loading branch information
rutujasurve94 committed Sep 7, 2020
1 parent c82c93e commit 17a6e03
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions jina/docker/hubio.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, args: 'argparse.Namespace'):
self.logger.critical('requires "docker" dependency, please install it via "pip install jina[docker]"')
raise

def new(self):
def new(self, create_cookiecutter: bool = True):
"""Create a new executor using cookiecutter template """
try:
from cookiecutter.main import cookiecutter
Expand All @@ -64,7 +64,8 @@ def new(self):
cookiecutter_template = 'https://github.com/jina-ai/cookiecutter-jina.git'
elif self.args.type == 'pod':
cookiecutter_template = 'https://github.com/jina-ai/cookiecutter-jina-hub.git'
cookiecutter(cookiecutter_template, overwrite_if_exists=self.args.overwrite, output_dir=self.args.output_dir)
if create_cookiecutter:
cookiecutter(cookiecutter_template, overwrite_if_exists=self.args.overwrite, output_dir=self.args.output_dir)

def push(self, name: str = None, readme_path: str = None):
"""A wrapper of docker push """
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ def test_hub_build_no_pymodules():

def test_hub_new():
args = set_hub_new_parser().parse_args(['--output-dir','.','--type','app'])
HubIO(args).new()
HubIO(args).new(create_cookiecutter=False)

args = set_hub_new_parser().parse_args(['--output-dir','.','--type','pod'])
HubIO(args).new(create_cookiecutter=False)

0 comments on commit 17a6e03

Please sign in to comment.