Merge lp:~cjohnston/summit/run-our-tests into lp:summit

Proposed by Chris Johnston
Status: Merged
Approved by: Michael Hall
Approved revision: 515
Merged at revision: 532
Proposed branch: lp:~cjohnston/summit/run-our-tests
Merge into: lp:summit
Diff against target: 79 lines (+40/-5)
3 files modified
summit/common/management/commands/test_apps.py (+11/-0)
summit/local_tests.py (+15/-0)
summit/settings.py (+14/-5)
To merge this branch: bzr merge lp:~cjohnston/summit/run-our-tests
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+156300@code.launchpad.net

Commit message

Make manage.py test run only our tests by default

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'summit/common/management/commands/test_apps.py'
2--- summit/common/management/commands/test_apps.py 1970-01-01 00:00:00 +0000
3+++ summit/common/management/commands/test_apps.py 2013-03-31 13:05:25 +0000
4@@ -0,0 +1,11 @@
5+from django.core.management import call_command
6+from django.core.management.base import BaseCommand
7+
8+from settings import LOCAL_APS
9+
10+
11+class Command(BaseCommand):
12+ """ test_apps command. """
13+
14+ def handle(self, *args, **options):
15+ call_command('test', *LOCAL_APPS)
16
17=== added file 'summit/local_tests.py'
18--- summit/local_tests.py 1970-01-01 00:00:00 +0000
19+++ summit/local_tests.py 2013-03-31 13:05:25 +0000
20@@ -0,0 +1,15 @@
21+from django.test.simple import DjangoTestSuiteRunner
22+from settings import LOCAL_APPS
23+
24+
25+class LocalAppsTestSuiteRunner(DjangoTestSuiteRunner):
26+ """ Override the default 'test' command to only run local tests. """
27+ def run_tests(self, test_labels, *args, **kwargs):
28+ if not test_labels:
29+ test_labels = LOCAL_APPS
30+
31+ return super(LocalAppsTestSuiteRunner, self).run_tests(
32+ test_labels,
33+ *args,
34+ **kwargs
35+ )
36
37=== modified file 'summit/settings.py'
38--- summit/settings.py 2013-03-09 05:14:19 +0000
39+++ summit/settings.py 2013-03-31 13:05:25 +0000
40@@ -28,7 +28,7 @@
41 SITE_ROOT = 'http://summit.ubuntu.com'
42
43 ADMINS = (
44-# ('Your Name', 'admin@example.com'),
45+ #('Your Name', 'admin@example.com'),
46 )
47
48 MANAGERS = ADMINS
49@@ -119,12 +119,19 @@
50 'django.contrib.admin',
51 'django.contrib.sites',
52 'django.contrib.staticfiles',
53- 'summit.schedule',
54- 'summit.sponsor',
55- 'summit.common',
56 'south',
57 ]
58
59+LOCAL_APPS = [
60+ 'schedule',
61+ 'sponsor',
62+ 'common',
63+]
64+
65+INSTALLED_APPS += LOCAL_APPS
66+
67+TEST_RUNNER = "local_tests.LocalAppsTestSuiteRunner"
68+
69 AUTHENTICATION_BACKENDS = (
70 'django_openid_auth.auth.OpenIDBackend',
71 'django.contrib.auth.backends.ModelBackend',
72@@ -177,4 +184,6 @@
73 try:
74 from local_settings import *
75 except ImportError:
76- logging.warning("No local_settings.py were found. See INSTALL for instructions.")
77+ logging.warning(
78+ "No local_settings.py were found. See INSTALL for instructions."
79+ )

Subscribers

People subscribed via source and target branches