Skip to content

Commit

Permalink
Make tests faster under REUSE_STATIC=0
Browse files Browse the repository at this point in the history
  • Loading branch information
mythmon committed Feb 25, 2016
1 parent cf20db1 commit 6d06e31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions kitsune/sumo/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from functools import wraps
from os import getenv
from smtplib import SMTPRecipientsRefused
import subprocess

from django.conf import settings
from django.core.cache import cache
from django.core.management import call_command
from django.test import TestCase as OriginalTestCase
from django.test.client import Client
from django.test.utils import override_settings
Expand Down Expand Up @@ -53,8 +53,13 @@ def setup_test_environment(self, **kwargs):
pass

if not getenv('REUSE_STATIC', 'false').lower() in ('true', '1', ''):
# Collect static files for pipeline to work correctly
call_command('collectstatic', interactive=False)
# Collect static files for pipeline to work correctly--do this with
# subprocess instead of directly calling the admin command,
# because collectstatic somehow retains emotional baggage
# which causes all the tests to take FOREVER to run.
cmdline = [sys.executable, 'manage.py', 'collectstatic', '--noinput']
print 'Running %r' % cmdline
subprocess.call(cmdline)

super(TestSuiteRunner, self).setup_test_environment(**kwargs)

Expand Down
4 changes: 2 additions & 2 deletions requirements/default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ django-nose==1.4.3
# sha256: jTddtwi8h_bfm7OulO3QG-0su2polKkneF3tmu3pg-8
https://github.com/gintas/django-picklefield/archive/54b11bdb177fd6140c3ae7d6e9744eaa2deda261.tar.gz#egg=django-picklefield

# sha256: ccvUbFUuSPP-NwLVQQkWStWAeAcN2dhixxF0dQbj5L4
django-pipeline==1.6.4
# sha256: qHdlkXjQIGzCbUPl35f4CZkbGPU5-VvsWnFkHaDXDkE
django-pipeline==1.6.5

# django-ratelimit: tags/v0.4.0~8
# sha256: 0aNL6oRLRBHhGYsH0mm3D7UQDaSnNbdsHJl_sPuUZGw
Expand Down

0 comments on commit 6d06e31

Please sign in to comment.