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.
 
 
 

49 lines
1.4 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. from util import assert_no_diff
  11. SCSS_SOURCE = File(__file__).parent.child_folder('scss')
  12. TEST_SITE = File(__file__).parent.parent.child_folder('_test')
  13. class TestSass(object):
  14. def setUp(self):
  15. TEST_SITE.make()
  16. TEST_SITE.parent.child_folder(
  17. 'sites/test_jinja').copy_contents_to(TEST_SITE)
  18. SCSS_SOURCE.copy_contents_to(TEST_SITE.child('content/media/css'))
  19. File(TEST_SITE.child('content/media/css/site.css')).delete()
  20. def tearDown(self):
  21. TEST_SITE.delete()
  22. def test_scss(self):
  23. s = Site(TEST_SITE)
  24. s.config.mode = 'prod'
  25. s.config.plugins = ['hyde.ext.plugins.css.SassPlugin']
  26. s.config.sass = {'files': ['media/css/sass.scss']}
  27. source = TEST_SITE.child('content/media/css/sass.scss')
  28. target = File(
  29. Folder(s.config.deploy_root_path).child('media/css/sass.css'))
  30. gen = Generator(s)
  31. gen.generate_resource_at_path(source)
  32. assert target.exists
  33. text = target.read_all()
  34. expected_text = File(SCSS_SOURCE.child('expected-sass.css')).read_all()
  35. print("TEXT" + "-" * 80)
  36. print(text)
  37. print("-" * 80)
  38. print(expected_text)
  39. assert_no_diff(expected_text, text)