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.
 
 
 

45 lines
925 B

  1. # -*- coding: utf-8 -*-
  2. """
  3. Use nose
  4. `$ pip install nose`
  5. `$ nosetests`
  6. """
  7. import os
  8. from hyde.layout import Layout, HYDE_DATA, LAYOUTS
  9. from fswrap import File
  10. from nose.tools import nottest, with_setup
  11. DATA_ROOT = File(__file__).parent.child_folder('data')
  12. LAYOUT_ROOT = DATA_ROOT.child_folder(LAYOUTS)
  13. @nottest
  14. def setup_data():
  15. DATA_ROOT.make()
  16. @nottest
  17. def cleanup_data():
  18. DATA_ROOT.delete()
  19. def test_find_layout_from_package_dir():
  20. f = Layout.find_layout()
  21. assert f.name == 'basic'
  22. assert f.child_folder('layout').exists
  23. @with_setup(setup_data, cleanup_data)
  24. def test_find_layout_from_env_var():
  25. f = Layout.find_layout()
  26. LAYOUT_ROOT.make()
  27. f.copy_to(LAYOUT_ROOT)
  28. os.environ[HYDE_DATA] = unicode(DATA_ROOT)
  29. f = Layout.find_layout()
  30. assert f.parent == LAYOUT_ROOT
  31. assert f.name == 'basic'
  32. assert f.child_folder('layout').exists
  33. del os.environ[HYDE_DATA]