A fork of hyde, the static site generation. Some patches will be pushed upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
1.2 KiB

  1. # -*- coding: utf-8 -*-
  2. """
  3. Use nose
  4. `$ pip install nose`
  5. `$ nosetests`
  6. """
  7. from hyde.generator import Generator
  8. from hyde.site import Site
  9. from fswrap import File, Folder
  10. LESS_SOURCE = File(__file__).parent.child_folder('less')
  11. TEST_SITE = File(__file__).parent.parent.child_folder('_test')
  12. class TestLess(object):
  13. def setUp(self):
  14. TEST_SITE.make()
  15. TEST_SITE.parent.child_folder(
  16. 'sites/test_jinja').copy_contents_to(TEST_SITE)
  17. LESS_SOURCE.copy_contents_to(TEST_SITE.child('content/media/css'))
  18. File(TEST_SITE.child('content/media/css/site.css')).delete()
  19. def tearDown(self):
  20. TEST_SITE.delete()
  21. def test_can_execute_less(self):
  22. s = Site(TEST_SITE)
  23. s.config.plugins = ['hyde.ext.plugins.css.LessCSSPlugin']
  24. source = TEST_SITE.child('content/media/css/site.less')
  25. target = File(
  26. Folder(s.config.deploy_root_path).child('media/css/site.css'))
  27. gen = Generator(s)
  28. gen.generate_resource_at_path(source)
  29. assert target.exists
  30. text = target.read_all()
  31. expected_text = File(LESS_SOURCE.child('expected-site.css')).read_all()
  32. assert text == expected_text
  33. return