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.
 
 
 

46 lines
950 B

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