From f90ffe001cfbeb73c57ceae32efed58ba729d7f6 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Thu, 22 Nov 2012 10:15:09 -0800 Subject: Move logic that does processing of the input into a separate process_input function. This should make it easier to test this logic in isolation later. --- tox/_quickstart.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tox/_quickstart.py') diff --git a/tox/_quickstart.py b/tox/_quickstart.py index 23c7d86..cb4e4ae 100644 --- a/tox/_quickstart.py +++ b/tox/_quickstart.py @@ -155,8 +155,6 @@ accept a default value, if one is given in brackets).''' if pyenv not in d: do_prompt(d, pyenv, 'Test your project with %s (Y/n)' % pyenv, 'Y', boolean) - d['envlist'] = ', '.join([env for env in all_envs if d[env] is True]) - print ''' What command should be used to test your project -- examples: - py.test @@ -168,8 +166,14 @@ What command should be used to test your project -- examples: print ''' What dependencies does your project have?''' do_prompt(d, 'deps', 'Comma-separated list of dependencies', ' ') + + +def process_input(d): + d['envlist'] = ', '.join([env for env in all_envs if d[env] is True]) d['deps'] = '\n' + '\n'.join([' %s' % dep.strip() for dep in d['deps'].split(',')]) + return d + def generate(d, overwrite=True, silent=False): """Generate project based on values in *d*.""" @@ -202,17 +206,21 @@ Execute `tox` to test your project. def main(argv=sys.argv): d = {} + if len(argv) > 3: print 'Usage: tox-quickstart [root]' sys.exit(1) elif len(argv) == 2: d['path'] = argv[1] + try: ask_user(d) except (KeyboardInterrupt, EOFError): print print '[Interrupted.]' return + + d = process_input(d) generate(d) -- cgit v1.2.1