Beispiel #1
0
class CssCompilerTestBase(object):
    actual_class = None
    root_file = None
    update_file = None

    def setUp(self):
        self.storage = PipelineFinderStorage()
        self.compiler = self.actual_class(False, self.storage)
        self.tmp_name = self.root_file + "-tmp"

        open(self.storage.path(self.root_file) + "-tmp", "w").close()

    def test_is_outdated(self):
        real_update_file = self.storage.path(self.update_file)
        real_tmp_file = self.storage.path(self.tmp_name)

        # First round, shoud be outdated
        utime(real_tmp_file, (0, 0))
        self.assertEqual(True, self.compiler.is_outdated(self.root_file, self.tmp_name))

        # Second round, should not be outdated
        utime(real_tmp_file, None)
        self.assertEqual(False, self.compiler.is_outdated(self.root_file, self.tmp_name))

        # Third and final round, a source file is changed, should be outdated
        utime(real_update_file, (time() + 1, time() + 1))
        self.assertEqual(True, self.compiler.is_outdated(self.root_file, self.tmp_name))

    def tearDown(self):
        self.storage.delete(self.tmp_name)
Beispiel #2
0
 def test_find_storage(self):
     try:
         storage = PipelineFinderStorage()
         storage.find_storage('app.css')
     except ValueError:
         self.fail()
Beispiel #3
0
    def setUp(self):
        self.storage = PipelineFinderStorage()
        self.compiler = self.actual_class(False, self.storage)
        self.tmp_name = self.root_file + "-tmp"

        open(self.storage.path(self.root_file) + "-tmp", "w").close()
 def test_find_storage(self):
     try:
         storage = PipelineFinderStorage()
         storage.find_storage('app.css')
     except ValueError:
         self.fail()