aboutsummaryrefslogtreecommitdiffstats
path: root/wkhtmltopdf/tests/run.py
diff options
context:
space:
mode:
Diffstat (limited to 'wkhtmltopdf/tests/run.py')
-rw-r--r--wkhtmltopdf/tests/run.py44
1 files changed, 16 insertions, 28 deletions
diff --git a/wkhtmltopdf/tests/run.py b/wkhtmltopdf/tests/run.py
index b969a29..e0021ab 100644
--- a/wkhtmltopdf/tests/run.py
+++ b/wkhtmltopdf/tests/run.py
@@ -9,28 +9,8 @@ DIRNAME = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.getcwd())
-def run_tests():
- # Utility function to executes tests.
- # Will be called twice. Once with DEBUG=True and once with DEBUG=False.
- try:
- django.setup()
- except AttributeError:
- pass # Django < 1.7; okay to ignore
-
-
- try:
- from django.test.runner import DiscoverRunner
- except ImportError:
- from discover_runner.runner import DiscoverRunner
-
-
- test_runner = DiscoverRunner(verbosity=1)
- failures = test_runner.run_tests(['wkhtmltopdf'])
- if failures:
- sys.exit(1)
-
settings.configure(
- DEBUG=True,
+ DEBUG=False,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
@@ -49,14 +29,22 @@ settings.configure(
MEDIA_URL='/media/',
STATIC_ROOT=os.path.join(DIRNAME, 'static'),
STATIC_URL='/static/',
- WKHTMLTOPDF_DEBUG=True,
+ WKHTMLTOPDF_DEBUG=False,
)
-# Run tests with True debug settings (persistent temporary files).
-run_tests()
+try:
+ django.setup()
+except AttributeError:
+ pass # Django < 1.7; okay to ignore
+
+
+try:
+ from django.test.runner import DiscoverRunner
+except ImportError:
+ from discover_runner.runner import DiscoverRunner
-settings.DEBUG = False
-settings.WKHTMLTOPDF_DEBUG = False
-# Run tests with False debug settings to test temporary file delete operations.
-run_tests()
+test_runner = DiscoverRunner(verbosity=1)
+failures = test_runner.run_tests(['wkhtmltopdf'])
+if failures:
+ sys.exit(1)