Skip to content

Commit

Permalink
all works as should, validate more user input
Browse files Browse the repository at this point in the history
  • Loading branch information
fivethreeo committed Feb 3, 2011
1 parent 0c778ae commit d97a9e0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 19 deletions.
35 changes: 21 additions & 14 deletions cms/test/run_tests.py
@@ -1,7 +1,7 @@
import sys
import os

def configure_settings(*test_args):
def configure_settings(env_name):
from cms.test import project
import cms

Expand All @@ -16,7 +16,7 @@ def configure_settings(*test_args):
os.path.join(PROJECT_DIR, 'templates'),
)

JUNIT_OUTPUT_DIR = os.path.join(os.path.abspath(os.path.dirname(cms.__file__)), '..')
JUNIT_OUTPUT_DIR = os.path.join(os.path.abspath(os.path.dirname(cms.__file__)), '..', 'junit-%s' % env_name)

ADMINS = tuple()
DEBUG = True
Expand Down Expand Up @@ -220,25 +220,32 @@ def run_tests(*test_args):
test_args.remove('--direct')
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", ".."))

settings = configure_settings(*test_args)

from django.test.utils import get_runner

failfast = False

test_labels = []

if test_args:
if '--failfast' in test_args:
test_args.remove('--failfast')
failfast = True

for label in test_args:
test_labels.append('cms.%s' % label)
test_args_enum = dict([ (val, idx) for idx, val in enumerate(test_args)])

env_name = ''
if '--env-name' in test_args:
env_name = test_args[test_args_enum['--env-name']+1]
test_args.remove('--env-name')
test_args.remove(env_name)

if '--failfast' in test_args:
test_args.remove('--failfast')
failfast = True

for label in test_args:
test_labels.append('cms.%s' % label)

if not test_labels:
test_labels.append('cms')


settings = configure_settings(env_name)

from django.test.utils import get_runner

failures = get_runner(settings)(verbosity=1, interactive=True, failfast=failfast).run_tests(test_labels)
sys.exit(failures)

Expand Down
9 changes: 7 additions & 2 deletions runtests.sh
Expand Up @@ -62,7 +62,7 @@ if [ ! "$suite" ]; then
echo "Running complete cms testsuite."
else
if [ $quicktest == false ]; then
echo "Can only run specific suite with --quicktesr"
echo "Can only run specific suite with --quicktest"
exit 1
fi
echo "Running cms test $suite."
Expand All @@ -72,8 +72,13 @@ if [ $quicktest == true ]; then
IFS=","
tenvs=( $toxenv )
for tenv in ${tenvs[@]}; do
if [ ! -d ".tox/$tenv" ]; then
echo ".tox/$tenv does not exist, run without --quicktest first"
exit 1
fi
read -p "Hit any key to run tests in tox env $tenv"
.tox/$tenv/bin/python cms/test/run_tests.py --direct $failfast $suite
# running tests without invoking tox to save time
.tox/$tenv/bin/python cms/test/run_tests.py --direct $failfast $suite
retcode=$?
done
else
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Expand Up @@ -5,9 +5,8 @@ envlist =

[testenv]
commands =
coverage run --rcfile=.coveragerc setup.py test
coverage xml
coverage html
coverage run --rcfile=.coveragerc cms/test/run_tests.py --direct --env-name {envname} # get rid of --direct somehow
coverage xml -o coverage-{envname}.xml
sitepackages = True

[testenv:py25-1.1.X]
Expand Down

0 comments on commit d97a9e0

Please sign in to comment.