diff options
author | Rocky Meza <rocky@fusionbox.com> | 2014-02-03 17:16:29 -0700 |
---|---|---|
committer | Rocky Meza <rocky@fusionbox.com> | 2014-02-03 17:16:29 -0700 |
commit | ae411e0b9723c1d63d8326c492bfdd5833c14094 (patch) | |
tree | ff1aa1dd8f5c4d3a282f7f9233d027f05fe7d2f7 | |
parent | 5e6cbfb3a36449a4cc767c5b086ea51561d3d014 (diff) | |
download | django-pyscss-ae411e0b9723c1d63d8326c492bfdd5833c14094.tar.gz |
Automatically call collectstatic in tests.
It was very easy to have tests fail because of stale static files.
-rw-r--r-- | README.rst | 6 | ||||
-rw-r--r-- | tests/test_scss.py | 4 | ||||
-rw-r--r-- | tests/utils.py | 8 |
3 files changed, 14 insertions, 4 deletions
@@ -74,7 +74,9 @@ add it to your ``COMPRESS_PRECOMPILERS`` setting. :: Running the tests ================= -You first have to run `./manage.py collectstatic` before you can run the tests -for the first time. After that, you can just run:: +You can run the tests by running. $ python setup.py test + +Please note that this will collecstatic into ``tmp/static/`` automatically as +some of the tests require the staticfiles to have been collected. diff --git a/tests/test_scss.py b/tests/test_scss.py index 19e035c..3178f6b 100644 --- a/tests/test_scss.py +++ b/tests/test_scss.py @@ -6,7 +6,7 @@ from django.conf import settings from django_pyscss.scss import DjangoScss -from tests.utils import clean_css +from tests.utils import clean_css, CollectStaticTestCase IMPORT_FOO = """ @@ -70,7 +70,7 @@ class FindersImportTest(ImportTestMixin, TestCase): @override_settings(DEBUG=False) -class StorageImportTest(ImportTestMixin, TestCase): +class StorageImportTest(ImportTestMixin, CollectStaticTestCase): pass diff --git a/tests/utils.py b/tests/utils.py index 9a6a48d..1936481 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,3 +1,11 @@ +from django.test import TestCase +from django.core.management import call_command + + +class CollectStaticTestCase(TestCase): + def setUp(self): + call_command('collectstatic', interactive=False) + super(CollectStaticTestCase, self).setUp() def clean_css(string): |