Few changes based on Cement boss template
This commit is contained in:
@@ -49,15 +49,12 @@ class WOApp(CementApp):
|
|||||||
# All built-in application bootstrapping (always run)
|
# All built-in application bootstrapping (always run)
|
||||||
bootstrap = 'wo.cli.bootstrap'
|
bootstrap = 'wo.cli.bootstrap'
|
||||||
|
|
||||||
# Optional plugin bootstrapping (only run if plugin is enabled)
|
# Internal plugins (ship with application code)
|
||||||
plugin_bootstrap = 'wo.cli.plugins'
|
plugin_bootstrap = 'wo.cli.plugins'
|
||||||
|
|
||||||
# Internal templates (ship with application code)
|
# Internal templates (ship with application code)
|
||||||
template_module = 'wo.cli.templates'
|
template_module = 'wo.cli.templates'
|
||||||
|
|
||||||
# Internal plugins (ship with application code)
|
|
||||||
plugin_bootstrap = 'wo.cli.plugins'
|
|
||||||
|
|
||||||
extensions = ['mustache']
|
extensions = ['mustache']
|
||||||
|
|
||||||
# default output handler
|
# default output handler
|
||||||
@@ -73,18 +70,23 @@ class WOApp(CementApp):
|
|||||||
class WOTestApp(WOApp):
|
class WOTestApp(WOApp):
|
||||||
"""A test app that is better suited for testing."""
|
"""A test app that is better suited for testing."""
|
||||||
class Meta:
|
class Meta:
|
||||||
|
# default argv to empty (don't use sys.argv)
|
||||||
argv = []
|
argv = []
|
||||||
|
|
||||||
|
# don't look for config files (could break tests)
|
||||||
config_files = []
|
config_files = []
|
||||||
exit_on_close = True
|
|
||||||
|
# don't call sys.exit() when app.close() is called in tests
|
||||||
|
exit_on_close = False
|
||||||
|
|
||||||
|
|
||||||
# Define the applicaiton object outside of main, as some libraries might wish
|
# Define the applicaiton object outside of main, as some libraries might wish
|
||||||
# to import it as a global (rather than passing it into another class/func)
|
# to import it as a global (rather than passing it into another class/func)
|
||||||
# app = WOApp()
|
app = WOApp()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
with WOApp() as app:
|
with app:
|
||||||
try:
|
try:
|
||||||
global sys
|
global sys
|
||||||
|
|
||||||
@@ -99,7 +101,7 @@ def main():
|
|||||||
app.exit_code = 1
|
app.exit_code = 1
|
||||||
except exc.WOError as e:
|
except exc.WOError as e:
|
||||||
# Catch our application errors and exit 1 (error)
|
# Catch our application errors and exit 1 (error)
|
||||||
print(e)
|
print('WOError > %s' % e)
|
||||||
app.exit_code = 1
|
app.exit_code = 1
|
||||||
except FrameworkError as e:
|
except FrameworkError as e:
|
||||||
# Catch framework errors and exit 1 (error)
|
# Catch framework errors and exit 1 (error)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"""Testing utilities for WordOps"""
|
"""Testing utilities for WordOps"""
|
||||||
from cement.utils.test import CementTestCase
|
from cement.utils.test import *
|
||||||
from wo.cli.main import WOTestApp
|
from wo.cli.main import WOTestApp
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user