Skip to content

Commit 50b13fb

Browse files
committed
Get rid of custom test runner.
Refs #426.
1 parent 3003c95 commit 50b13fb

File tree

7 files changed

+81
-81
lines changed

7 files changed

+81
-81
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ matrix:
1515
env: DJANGO_VERSION=1.4.8
1616
install:
1717
- pip install Django==$DJANGO_VERSION
18-
script: python setup.py test
18+
script: make test

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Make file to compress and join all JS files
22
all: compress_js compress_css
33

4+
.PHONY: flake8 example test compress_js compress_css translatable_strings update_translations
5+
46
flake8:
5-
flake8 *.py debug_toolbar example tests
7+
flake8 debug_toolbar example tests
8+
9+
example:
10+
PYTHONPATH=. django-admin.py runserver --settings=example.settings
611

712
test:
8-
python runtests.py
13+
PYTHONPATH=. django-admin.py test --settings=tests.settings tests
914

1015
compress_js:
1116
yuicompressor debug_toolbar/static/debug_toolbar/js/jquery.js > debug_toolbar/static/debug_toolbar/js/toolbar.min.js

runtests.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
'django>=1.4.2,<1.6',
1717
'sqlparse',
1818
],
19-
test_suite='runtests.runtests',
2019
include_package_data=True,
2120
zip_safe=False, # because we're including static files
2221
classifiers=[

tests/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Refresh the debug toolbar's configuration when overriding settings.
2+
3+
from debug_toolbar.utils.settings import CONFIG, CONFIG_DEFAULTS
4+
from django.dispatch import receiver
5+
from django.test.signals import setting_changed
6+
7+
8+
@receiver(setting_changed)
9+
def update_toolbar_config(**kwargs):
10+
if kwargs['setting'] == 'DEBUG_TOOLBAR_CONFIG':
11+
CONFIG.update(CONFIG_DEFAULTS)
12+
CONFIG.update(kwargs['value'] or {})

tests/settings.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"""Django settings for tests."""
2+
3+
import os
4+
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
5+
6+
7+
# Quick-start development settings - unsuitable for production
8+
9+
SECRET_KEY = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
10+
11+
DEBUG = True
12+
13+
INTERNAL_IPS = ['127.0.0.1', '::1']
14+
15+
TEMPLATE_DEBUG = True
16+
17+
18+
# Application definition
19+
20+
INSTALLED_APPS = (
21+
'django.contrib.admin',
22+
'django.contrib.auth',
23+
'django.contrib.contenttypes',
24+
'django.contrib.sessions',
25+
'django.contrib.messages',
26+
'django.contrib.staticfiles',
27+
'debug_toolbar',
28+
'tests',
29+
)
30+
31+
MIDDLEWARE_CLASSES = (
32+
'debug_toolbar.middleware.DebugToolbarMiddleware',
33+
'django.contrib.sessions.middleware.SessionMiddleware',
34+
'django.middleware.common.CommonMiddleware',
35+
'django.middleware.csrf.CsrfViewMiddleware',
36+
'django.contrib.auth.middleware.AuthenticationMiddleware',
37+
'django.contrib.messages.middleware.MessageMiddleware',
38+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
39+
)
40+
41+
ROOT_URLCONF = 'tests.urls'
42+
43+
STATIC_URL = '/static/'
44+
45+
46+
# Cache and database
47+
48+
CACHES = {
49+
'default': {
50+
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
51+
}
52+
}
53+
54+
DATABASES = {
55+
'default': {
56+
'ENGINE': 'django.db.backends.sqlite3',
57+
}
58+
}

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ envlist =
1313
flake8
1414

1515
[testenv]
16-
commands = python runtests.py
16+
commands = make test
1717
deps =
1818
sqlparse
19+
whitelist_externals = make
1920

2021
[testenv:py26-django14]
2122
basepython = python2.6
@@ -78,6 +79,6 @@ deps =
7879
{[testenv]deps}
7980

8081
[testenv:flake8]
81-
commands = flake8 debug_toolbar example tests
82+
commands = make flake8
8283
deps =
8384
flake8

0 commit comments

Comments
 (0)