From 5401c0efc4d0b251415c846cba943c47799de7ed Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Tue, 8 Mar 2011 15:14:43 +0530 Subject: [PATCH] Added test for stylus compression --- hyde/tests/ext/test_stylus.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/hyde/tests/ext/test_stylus.py b/hyde/tests/ext/test_stylus.py index 48b3fd4..5b98531 100644 --- a/hyde/tests/ext/test_stylus.py +++ b/hyde/tests/ext/test_stylus.py @@ -44,4 +44,25 @@ class TestLess(object): assert target.exists text = target.read_all() expected_text = File(STYLUS_SOURCE.child('expected-site.css')).read_all() + assert text.strip() == expected_text.strip() + + def test_can_compress_with_stylus(self): + s = Site(TEST_SITE) + s.config.mode = "production" + s.config.plugins = ['hyde.ext.plugins.stylus.StylusPlugin'] + paths = ['/usr/local/share/npm/bin/stylus', '~/local/bin/stylus'] + stylus = [path for path in paths if File(path).exists] + if not stylus: + assert False, "Cannot find the stylus executable" + + stylus = stylus[0] + s.config.stylus = Expando(dict(app=stylus)) + source = TEST_SITE.child('content/media/css/site.styl') + target = File(Folder(s.config.deploy_root_path).child('media/css/site.css')) + gen = Generator(s) + gen.generate_resource_at_path(source) + + assert target.exists + text = target.read_all() + expected_text = File(STYLUS_SOURCE.child('expected-site-compressed.css')).read_all() assert text.strip() == expected_text.strip() \ No newline at end of file