more testing

This commit is contained in:
BJ Dierkes 2011-05-18 04:01:10 -05:00
parent 663bf3c3bc
commit f78238e8ad
6 changed files with 31 additions and 8 deletions

2
.gitignore vendored
View File

@ -49,9 +49,11 @@ pip-log.txt
# Unit test / coverage reports
.coverage
htmlcov
.tox
# TextMate
*.tmproj
*.tmproject
tmtags

View File

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@ -3,7 +3,7 @@
import sys
from cement.core.backend import default_config, minimal_logger
from cement.core.exc import CementConfigError
from cement.core import exc
from cement.core import handler, hook
from cement.core.log import ILogHandler, LoggingLogHandler
from cement.core.config import IConfigHandler, ConfigParserConfigHandler
@ -81,7 +81,11 @@ class CementApp(object):
self._setup_logging()
def load_ext(self, ext_name):
__import__("cement.ext.ext_%s" % ext_name)
module = "cement.ext.ext_%s" % ext_name
try:
__import__(module)
except ImportError, e:
raise exc.CementRuntimeError, e.args[0]
def _setup_config(self):
if not self.config:
@ -106,7 +110,7 @@ class CementApp(object):
if not c.has_key('base', 'app_name') or \
not c.get('base', 'app_name'):
raise CementConfigError("config['app_name'] required.")
raise exc.CementConfigError("config['app_name'] required.")
if not c.has_key('base', 'app_module') or \
not c.get('base', 'app_module'):
c.set('base', 'app_module', c.get('base', 'app_name'))

13
src/cement2/setup.cfg Normal file
View File

@ -0,0 +1,13 @@
[nosetests]
where=tests/
#verbosity=3
debug=0
detailed-errors=1
with-coverage=1
cover-package=cement
#cover-erase=1
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1

View File

@ -60,15 +60,18 @@ setup(name='cement',
zip_safe=False,
test_suite='nose.collector',
install_requires=[
# Required for documentation
#"Sphinx >= 1.0",
#"Pygments",
### Required to build documentation
# "Sphinx >= 1.0",
# "Pygments",
### Required for testing
# "nose",
# "coverage",
],
setup_requires=[
],
entry_points="""
""",
namespace_packages=[
'cement.ext'
#'cement.ext'
],
)

View File

@ -19,7 +19,7 @@ def my_hook_three(*args, **kw):
config = default_config()
config['base']['config_files'] = ['./test.conf', 'asdfasdfasdf.conf']
config['base']['config_handler'] = 'configparser'
config['base']['config_handler'] = 'configobj'
config['log']['debug'] = True
app = lay_cement('myapp', defaults=config)