summaryrefslogtreecommitdiff
path: root/tox/_quickstart.py
diff options
context:
space:
mode:
authorMarc Abramowitz <marc@marc-abramowitz.com>2012-11-22 10:15:09 -0800
committerMarc Abramowitz <marc@marc-abramowitz.com>2012-11-22 10:15:09 -0800
commitf90ffe001cfbeb73c57ceae32efed58ba729d7f6 (patch)
tree42efc830a667a14b3a7cc29269d9b345411ebf87 /tox/_quickstart.py
parent607bee833e1a09f71cffc1e3f4cb4a44a8472b69 (diff)
downloadtox-f90ffe001cfbeb73c57ceae32efed58ba729d7f6.tar.gz
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.
Diffstat (limited to 'tox/_quickstart.py')
-rw-r--r--tox/_quickstart.py12
1 files changed, 10 insertions, 2 deletions
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)