diff options
author | Ryan Petrello <lists@ryanpetrello.com> | 2012-03-15 14:52:32 -0700 |
---|---|---|
committer | Ryan Petrello <lists@ryanpetrello.com> | 2012-03-15 14:55:49 -0700 |
commit | 6b3d90328f60803ec39ec7989f938ec8943964c4 (patch) | |
tree | cf344a8b241e49888e14229334ae28716867b1e6 /pecan/commands | |
parent | 34b02a253dec84b13317497c5e8d291ba1a9ef63 (diff) | |
download | pecan-6b3d90328f60803ec39ec7989f938ec8943964c4.tar.gz |
More test coverage.
Diffstat (limited to 'pecan/commands')
-rw-r--r-- | pecan/commands/base.py | 12 | ||||
-rw-r--r-- | pecan/commands/create.py | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/pecan/commands/base.py b/pecan/commands/base.py index b997d9f..2bb2581 100644 --- a/pecan/commands/base.py +++ b/pecan/commands/base.py @@ -4,14 +4,13 @@ import argparse import logging import sys from warnings import warn -from pecan import load_app log = logging.getLogger(__name__) class HelpfulArgumentParser(argparse.ArgumentParser): - def error(self, message): + def error(self, message): # pragma: nocover """error(message: string) Prints a usage message incorporating the message to stderr and @@ -38,7 +37,7 @@ class CommandManager(object): try: cmd = ep.load() assert hasattr(cmd, 'run') - except Exception, e: + except Exception, e: # pragma: nocover warn("Unable to load plugin %s: %s" % (ep, e), RuntimeWarning) continue self.add({ep.name: cmd}) @@ -77,7 +76,7 @@ class CommandRunner(object): self.commands[ns.command_name]().run(ns) @classmethod - def handle_command_line(cls): + def handle_command_line(cls): # pragma: nocover runner = CommandRunner() runner.run(sys.argv[1:]) @@ -86,10 +85,10 @@ class CommandRunner(object): try: dist = pkg_resources.get_distribution('Pecan') if os.path.dirname(os.path.dirname(__file__)) == dist.location: - return dist.version + return dist.version # pragma: nocover else: return '(development)' - except: + except: # pragma: nocover return '(development)' @property @@ -114,6 +113,7 @@ class BaseCommand(object): self.args = args def load_app(self): + from pecan import load_app if not os.path.isfile(self.args.config_file): raise RuntimeError('`%s` is not a file.' % self.args.config_file) return load_app(self.args.config_file) diff --git a/pecan/commands/create.py b/pecan/commands/create.py index 508f766..df84f01 100644 --- a/pecan/commands/create.py +++ b/pecan/commands/create.py @@ -23,7 +23,7 @@ class ScaffoldManager(object): try: cmd = ep.load() assert hasattr(cmd, 'copy_to') - except Exception, e: + except Exception, e: # pragma: nocover warn( "Unable to load scaffold %s: %s" % (ep, e), RuntimeWarning ) @@ -55,6 +55,6 @@ class CreateCommand(BaseCommand): def run(self, args): super(CreateCommand, self).run(args) - CreateCommand.manager.scaffolds[args.template_name]().copy_to( + self.manager.scaffolds[args.template_name]().copy_to( args.project_name ) |