本文整理汇总了Python中paste.script.appinstall.SetupCommand类的典型用法代码示例。如果您正苦于以下问题:Python SetupCommand类的具体用法?Python SetupCommand怎么用?Python SetupCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SetupCommand类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_basic_test
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
'''
Create clean environment for running tests, includes mongodb connection with "mim" (mongo-in-memory) and sample
data created.
A lightweight alternative is setup_config_test which doesn't bootstrap app data.
'''
try:
conf_dir = tg.config.here
except AttributeError:
conf_dir = os.getcwd()
test_file = os.path.join(conf_dir, get_config_file(config))
"""
# setup our app, from TG quickstart example:
from tg.util import Bunch
from gearbox.commands.setup_app import SetupAppCommand
cmd = SetupAppCommand(Bunch(options=Bunch(verbose_level=1)), Bunch())
cmd.run(Bunch(config_file='config:{}'.format(test_file), section_name=None))
"""
# setup our app without depending on gearbox (we still depend on Paste anyway)
# uses [paste.app_install] entry point which call our setup_app()
cmd = SetupCommand('setup-app')
cmd.run([test_file])
ew.TemplateEngine.initialize({})
# remove unnecessary bootstrap tasks, e.g. search indexing
M.MonQTask.query.remove({'state': 'ready'})
示例2: setUpModule
def setUpModule():
# Loading the application:
conf_dir = config.here
wsgiapp = loadapp('config:test.ini#main_without_authn',
relative_to=conf_dir)
global app
app = TestApp(wsgiapp)
# Setting it up:
test_file = path.join(conf_dir, 'test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])
# Prepare authz test data
subm_100 = model.Submission(id=100, filename=u'subm_100', source=u'subm_100',
assignment=model.Assignment.query.filter_by(id=2).one(),
user=model.User.query.filter_by(user_name='studentc1').one(),
language=model.Language.query.first())
subm_101 = model.Submission(id=101, filename=u'subm_101', source=u'subm_101',
assignment=model.Assignment.query.filter_by(id=2).one(),
user=model.User.query.filter_by(user_name='studentc2').one(),
language=model.Language.query.first())
subm_102 = model.Submission(id=102, filename=u'subm_102', source=u'subm_102',
assignment=model.Assignment.query.filter_by(id=2).one(),
user=model.User.query.filter_by(user_name='studente1').one(),
language=model.Language.query.first())
model.DBSession.add_all((subm_100, subm_101, subm_102))
transaction.commit()
示例3: setUp
def setUp(self):
wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
relative_to='.')
self.app = TestApp(wsgiapp)
# Setting it up:
test_file = os.path.abspath('test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])
示例4: setUp
def setUp(self):
"""Method called by nose before running each test"""
# Loading the application:
conf_dir = config.here
wsgiapp = loadapp("config:test.ini#%s" % self.application_under_test, relative_to=conf_dir)
self.app = TestApp(wsgiapp)
# Setting it up:
test_file = path.join(conf_dir, "test.ini")
cmd = SetupCommand("setup-app")
cmd.run([test_file])
示例5: setUp
def setUp(self):
# Loading the application:
conf_dir = config.here
wsgiapp = loadapp('config:test.ini#%s' % self.application_under_test,
relative_to=conf_dir)
self.app = TestApp(wsgiapp)
# Setting it up:
test_file = path.join(conf_dir, 'test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])
示例6: setUpModule
def setUpModule():
# Loading the application:
conf_dir = config.here
wsgiapp = loadapp('config:test.ini#main_without_authn',
relative_to=conf_dir)
global app
app = TestApp(wsgiapp)
# Setting it up:
test_file = path.join(conf_dir, 'test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])
示例7: setup_app
def setup_app(application):
# Loading the application:
conf_dir = config.here
wsgiapp = loadapp('config:test.ini#%s' % application,
relative_to=conf_dir)
app = TestApp(wsgiapp)
# Setting it up:
test_file = path.join(conf_dir, 'test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])
return app
示例8: setup_basic_test
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
'''Create clean environment for running tests'''
try:
conf_dir = tg.config.here
except AttributeError:
conf_dir = os.getcwd()
ew.TemplateEngine.initialize({})
test_file = os.path.join(conf_dir, get_config_file(config))
cmd = SetupCommand('setup-app')
cmd.run([test_file])
# run all tasks, e.g. indexing from bootstrap operations
while M.MonQTask.run_ready('setup'):
ThreadLocalORMSession.flush_all()
示例9: setup_basic_test
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
"""
Create clean environment for running tests.
A lightweight alternative is setup_config_test which doesn't bootstrap app data.
"""
try:
conf_dir = tg.config.here
except AttributeError:
conf_dir = os.getcwd()
test_file = os.path.join(conf_dir, get_config_file(config))
cmd = SetupCommand("setup-app")
cmd.run([test_file])
ew.TemplateEngine.initialize({})
# remove unnecessary bootstrap tasks, e.g. search indexing
M.MonQTask.query.remove({"state": "ready"})
示例10: setup_basic_test
def setup_basic_test(config=None, app_name=DFL_APP_NAME):
'''
Create clean environment for running tests, includes mongodb connection with "mim" (mongo-in-memory) and sample
data created.
A lightweight alternative is setup_config_test which doesn't bootstrap app data.
'''
try:
conf_dir = tg.config.here
except AttributeError:
conf_dir = os.getcwd()
test_file = os.path.join(conf_dir, get_config_file(config))
cmd = SetupCommand('setup-app')
cmd.run([test_file])
ew.TemplateEngine.initialize({})
# remove unnecessary bootstrap tasks, e.g. search indexing
M.MonQTask.query.remove({'state': 'ready'})
示例11: setUpModule
def setUpModule():
# Loading the application:
conf_dir = config.here
wsgiapp = loadapp('config:test.ini#main_without_authn',
relative_to=conf_dir)
global app
app = TestApp(wsgiapp)
# Setting it up:
test_file = path.join(conf_dir, 'test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])
# Prepare nullable=True test data
u = model.User(id=0, user_name='empty', email_address='empty', display_name=None, created=None)
e = model.Course(id=0, name='Empty', _url='empty', description=None, enabled=True)
s = model.Sheet(id=0, name='Empty', sheet_id='0', event=e, description=None)
a = model.Assignment(id=0, name='Empty', assignment_id='0', sheet=s, description=None, timeout=None)
ss = model.Submission(id=0, user=u, assignment=a, filename=None, source=None, language=None)
j = model.Judgement(id=0, submission=ss, tutor=u)
model.DBSession.add_all((u, e, a, s, ss, j))
transaction.commit()
示例12: setUpModule
def setUpModule():
# Loading the application:
conf_dir = config.here
wsgiapp = loadapp('config:test.ini#main_without_authn',
relative_to=conf_dir)
global app
app = TestApp(wsgiapp)
# Setting it up:
test_file = path.join(conf_dir, 'test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])
# Prepare authz test data
subm_100 = model.Submission(id=100, filename=u'subm_100', source=u'subm_100',
assignment=model.Assignment.query.filter_by(id=2).one(),
user=model.User.query.filter_by(user_name='studentc1').one(),
language=model.Language.query.first(),
judgement=model.Judgement(
tutor=model.User.query.filter_by(user_name='tutor1').one(),
corrected_source=u'subm-100', comment=u'Good good',
annotations={1: 'No no no'}, grade=3.14))
model.DBSession.add(subm_100)
subm_101 = model.Submission(id=101, filename=u'subm_101', source=u'subm_101',
assignment=model.Assignment.query.filter_by(id=2).one(),
user=model.User.query.filter_by(user_name='studentc2').one(),
language=model.Language.query.first())
model.DBSession.add(subm_101)
subm_102 = model.Submission(id=102, filename=u'subm_102', source=u'subm_102',
assignment=model.Assignment.query.filter_by(id=2).one(),
user=model.User.query.filter_by(user_name='studente1').one(),
language=model.Language.query.first())
model.DBSession.add(subm_102)
subm_103 = model.Submission(id=103, filename=u'subm_103', source=u'subm_103',
assignment=model.Assignment.query.filter_by(id=2).one(),
user=model.User.query.filter_by(user_name='studente1').one(),
language=model.Language.query.first(),
public=True)
model.DBSession.add(subm_103)
transaction.commit()
示例13: setup_app
def setup_app():
test_file = path.join(config.here, 'test.ini')
cmd = SetupCommand('setup-app')
cmd.run([test_file])