Skip to content

Commit

Permalink
Use nose test runner by default
Browse files Browse the repository at this point in the history
  • Loading branch information
millerdev committed May 19, 2016
1 parent 35760dc commit 4350c9e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions dev_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
'testapps.test_pillowtop',
)

# TEST_RUNNER is overridden in testsettings, which is the default settings
# module for the test command (see manage.py); this has no effect by default.
# Use ./manage.py test --settings=settings to use this setting.
TEST_RUNNER = 'testrunner.DevTestRunner'

SKIP_TESTS_REQUIRING_EXTRA_SETUP = True
Expand Down
10 changes: 9 additions & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ def _should_patch_gevent(args, gevent_commands):
return should_patch


def set_default_settings_path(argv):
if len(argv) > 1 and argv[1] == 'test':
module = 'testsettings'
else:
module = 'settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", module)


if __name__ == "__main__":
init_hq_python_path()

Expand Down Expand Up @@ -83,6 +91,6 @@ def _should_patch_gevent(args, gevent_commands):
# workaround for https://github.com/smore-inc/tinys3/issues/33
mimetypes.init()

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
set_default_settings_path(sys.argv)
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
5 changes: 0 additions & 5 deletions requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,4 @@ psutil # for memory profiling
django-extensions
ipdb

# these will eventually move to test-requirements.txt
nose==1.3.7
git+git://github.com/millerdev/nose-exclude@exclude-tests-env#egg=nose-exclude
git+git://github.com/millerdev/django-nose@fast-first#egg=django-nose

--requirement=test-requirements.txt
3 changes: 3 additions & 0 deletions requirements/test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
beautifulsoup4>=4.4.1
coverage
git+git://github.com/millerdev/django-nose@fast-first#egg=django-nose
fakecouch==0.0.8
mocker==1.1.1
nose==1.3.7
git+git://github.com/millerdev/nose-exclude@exclude-tests-env#egg=nose-exclude
testil
unittest2
3 changes: 2 additions & 1 deletion testsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
'NOSE_IGNORE_FILES': '^localsettings',

'NOSE_EXCLUDE_DIRS': ';'.join([
'corehq/apps/cloudcare/tests/selenium',
'corehq/apps/reports/tests/selenium',
'scripts',

# strange error:
Expand Down Expand Up @@ -68,7 +70,6 @@
# override dev_settings
CACHE_REPORTS = True


def _set_logging_levels(levels):
import logging
for path, level in levels.items():
Expand Down

0 comments on commit 4350c9e

Please sign in to comment.