| @@ -65,7 +65,6 @@ class TestConfig(object): | |||||
| assert c.deploy_root_path == TEST_SITE_ROOT.child_folder('deploy') | assert c.deploy_root_path == TEST_SITE_ROOT.child_folder('deploy') | ||||
| def test_conf1(self): | def test_conf1(self): | ||||
| c = Config(sitepath=TEST_SITE_ROOT, config_dict=yaml.load(self.conf1)) | c = Config(sitepath=TEST_SITE_ROOT, config_dict=yaml.load(self.conf1)) | ||||
| assert c.content_root_path == TEST_SITE_ROOT.child_folder('stuff') | assert c.content_root_path == TEST_SITE_ROOT.child_folder('stuff') | ||||
| @@ -0,0 +1,19 @@ | |||||
| # -*- coding: utf-8 -*- | |||||
| """ | |||||
| Use nose | |||||
| `$ pip install nose` | |||||
| `$ nosetests` | |||||
| """ | |||||
| from hyde.util import load_python_object | |||||
| import os | |||||
| def test_can_load_locals(): | |||||
| file_class = load_python_object('hyde.fs.File') | |||||
| assert file_class | |||||
| f = file_class(__file__) | |||||
| assert f | |||||
| assert f.name == os.path.basename(__file__) | |||||
| @@ -0,0 +1,14 @@ | |||||
| """ | |||||
| Hyde utilities | |||||
| """ | |||||
| import sys | |||||
| def load_python_object(name): | |||||
| """ | |||||
| Loads a python module from string | |||||
| """ | |||||
| (module_name, _ , object_name) = name.rpartition(".") | |||||
| __import__(module_name) | |||||
| module = sys.modules[module_name] | |||||
| return getattr(module, object_name) | |||||