File: utils.py

package info (click to toggle)
python-django-pyscss 2.0.2-4~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 260 kB
  • sloc: python: 416; makefile: 35
file content (27 lines) | stat: -rw-r--r-- 760 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import shutil

from django.test import TestCase
from django.core.management import call_command
from django.conf import settings


class CollectStaticTestCase(TestCase):
    @classmethod
    def setUpClass(cls):
        super(CollectStaticTestCase, cls).setUpClass()
        call_command('collectstatic', interactive=False, verbosity=0)


class NoCollectStaticTestCase(TestCase):
    @classmethod
    def setUpClass(cls):
        super(NoCollectStaticTestCase, cls).setUpClass()
        shutil.rmtree(settings.STATIC_ROOT, ignore_errors=True)


def clean_css(string):
    # The output of the compiled CSS doesn't have a newline between the ; and
    # the } for some reason.
    return string.strip() \
        .replace('\n', '') \
        .replace('; ', ';')