# Path: egasub/cli.py
# def print_version(ctx, param, value):
#     if not value or ctx.resilient_parsing:
#         return
#     click.echo('egasub %s' % ver)
#     ctx.exit()
# 
# @click.group()
# @click.option('--debug/--no-debug', '-d', default=False)
# @click.option('--info/--no-info','-i', default=True)
# @click.option('--version', '-v', is_flag=True, callback=print_version,
#               expose_value=False, is_eager=True)
# @click.pass_context
# def main(ctx, debug, info):
#     # initializing ctx.obj
#     ctx.obj = {}
#     ctx.obj['IS_TEST'] = False
#     ctx.obj['CURRENT_DIR'] = os.getcwd()
#     ctx.obj['IS_TEST_PROJ'] = None
#     ctx.obj['WORKSPACE_PATH'] = utils.find_workspace_root(cwd=ctx.obj['CURRENT_DIR'])
#     utils.initialize_log(ctx, debug, info)
# 
# @main.command()
# @click.argument('submission_dir', type=click.Path(exists=True), nargs=-1)
# @click.pass_context
# def dry_run(ctx, submission_dir):
#     """
#     Test submission on submission folder(s).
#     """
#     if '.' in submission_dir or '..' in submission_dir:
#         ctx.obj['LOGGER'].critical("Submission dir can not be '.' or '..'")
#         ctx.abort()
# 
#     utils.initialize_app(ctx)
# 
#     if not submission_dir:
#         ctx.obj['LOGGER'].critical('You must specify at least one submission directory.')
#         ctx.abort()
# 
#     perform_submission(ctx, submission_dir, dry_run=True)


from egasub.cli import print_version, main, dry_run
import pytest
import os

def test_print_version(ctx):
    ctx.resilient_parsing = True
    assert print_version(ctx, 'version 1', True) is None
    ctx.resilient_parsing = False
    with pytest.raises(Exception):

# Path: egasub/cli.py
# def print_version(ctx, param, value):
#     if not value or ctx.resilient_parsing:
#         return
#     click.echo('egasub %s' % ver)
#     ctx.exit()
# 
# @click.group()
# @click.option('--debug/--no-debug', '-d', default=False)
# @click.option('--info/--no-info','-i', default=True)
# @click.option('--version', '-v', is_flag=True, callback=print_version,
#               expose_value=False, is_eager=True)
# @click.pass_context
# def main(ctx, debug, info):
#     # initializing ctx.obj
#     ctx.obj = {}
#     ctx.obj['IS_TEST'] = False
#     ctx.obj['CURRENT_DIR'] = os.getcwd()
#     ctx.obj['IS_TEST_PROJ'] = None
#     ctx.obj['WORKSPACE_PATH'] = utils.find_workspace_root(cwd=ctx.obj['CURRENT_DIR'])
#     utils.initialize_log(ctx, debug, info)
# 
# @main.command()
# @click.argument('submission_dir', type=click.Path(exists=True), nargs=-1)
# @click.pass_context
# def dry_run(ctx, submission_dir):
#     """
#     Test submission on submission folder(s).
#     """
#     if '.' in submission_dir or '..' in submission_dir:
#         ctx.obj['LOGGER'].critical("Submission dir can not be '.' or '..'")
#         ctx.abort()
# 
#     utils.initialize_app(ctx)
# 
#     if not submission_dir:
#         ctx.obj['LOGGER'].critical('You must specify at least one submission directory.')
#         ctx.abort()
# 
#     perform_submission(ctx, submission_dir, dry_run=True)


# Path: tests/submission/test_cli.py
from egasub.cli import print_version, main, dry_run
import pytest
import os


def test_print_version(ctx):
    ctx.resilient_parsing = True
    assert print_version(ctx, 'version 1', True) is None
    ctx.resilient_parsing = False
    with pytest.raises(Exception):

        print_version(ctx, 'version 1', True)