本文整理匯總了Python中workflow.workflow.Workflow.reset方法的典型用法代碼示例。如果您正苦於以下問題:Python Workflow.reset方法的具體用法?Python Workflow.reset怎麽用?Python Workflow.reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類workflow.workflow.Workflow
的用法示例。
在下文中一共展示了Workflow.reset方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_last_version_explicit_version
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_last_version_explicit_version(self):
"""Workflow: last_version explicit version"""
vstr = '1.9.6'
wf = Workflow()
self.assertTrue(wf.set_last_version(vstr))
self.assertEqual(wf.last_version_run, Version(vstr))
wf.reset()
示例2: test_first_run_with_version
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_first_run_with_version(alfred4, infopl):
"""Workflow: first_run"""
vstr = '1.9.7'
with env(alfred_workflow_version=vstr):
wf = Workflow()
assert wf.first_run is True
wf.reset()
示例3: test_last_version_explicit_version
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_last_version_explicit_version(alfred4, infopl):
"""Workflow: last_version explicit version"""
vstr = '1.9.6'
wf = Workflow()
assert wf.set_last_version(vstr) is True
assert wf.last_version_run == Version(vstr)
wf.reset()
示例4: test_run_fails
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_run_fails(infopl):
"""Run fails"""
wf = Workflow()
def cb(wf2):
assert wf2 is wf
raise ValueError('Have an error')
wf.help_url = 'http://www.deanishe.net/alfred-workflow/'
ret = wf.run(cb)
assert ret == 1
# read name from info.plist
with env(alfred_workflow_name=None):
wf = Workflow()
wf.name
ret = wf.run(cb)
assert ret == 1
# named after bundleid
wf = Workflow()
wf.bundleid
ret = wf.run(cb)
assert ret == 1
wf.reset()
示例5: test_last_version_auto_version
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_last_version_auto_version(alfred4, infopl):
"""Workflow: last_version auto version"""
vstr = '1.9.7'
with env(alfred_workflow_version=vstr):
wf = Workflow()
assert wf.set_last_version() is True
assert wf.last_version_run == Version(vstr)
wf.reset()
示例6: test_first_run_with_version
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_first_run_with_version(self):
"""Workflow: first_run"""
vstr = '1.9.7'
with VersionFile(vstr):
with InfoPlist():
wf = Workflow()
self.assertTrue(wf.first_run)
wf.reset()
示例7: test_first_run_no_version
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_first_run_no_version(alfred4, infopl2):
"""Workflow: first_run fails on no version"""
with env(alfred_workflow_version=None):
wf = Workflow()
try:
with pytest.raises(ValueError):
wf.first_run
finally:
wf.reset()
示例8: test_last_version_auto_version
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_last_version_auto_version(self):
"""Workflow: last_version auto version"""
vstr = '1.9.7'
with VersionFile(vstr):
with InfoPlist():
wf = Workflow()
self.assertTrue(wf.set_last_version())
self.assertEqual(wf.last_version_run, Version(vstr))
wf.reset()
示例9: test_additional_libs
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_additional_libs(alfred4, infopl):
"""Additional libraries"""
wf = Workflow(libraries=LIBS)
for path in LIBS:
assert path in sys.path
assert sys.path[0:len(LIBS)] == LIBS
import youcanimportme
youcanimportme.noop()
wf.reset()
示例10: test_first_run_with_previous_run
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_first_run_with_previous_run(alfred4, infopl):
"""Workflow: first_run with previous run"""
vstr = '1.9.7'
last_vstr = '1.9.6'
with env(alfred_workflow_version=vstr):
wf = Workflow()
wf.set_last_version(last_vstr)
assert wf.first_run is True
assert wf.last_version_run == Version(last_vstr)
wf.reset()
示例11: test_first_run_with_previous_run
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_first_run_with_previous_run(self):
"""Workflow: first_run with previous run"""
vstr = '1.9.7'
last_vstr = '1.9.6'
with VersionFile(vstr):
with InfoPlist():
wf = Workflow()
wf.set_last_version(last_vstr)
self.assertTrue(wf.first_run)
self.assertEqual(wf.last_version_run, Version(last_vstr))
wf.reset()
示例12: test_last_version_set_after_run
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_last_version_set_after_run(alfred4, infopl):
"""Workflow: last_version set after `run()`"""
vstr = '1.9.7'
def cb(wf):
return
with env(alfred_workflow_version=vstr):
wf = Workflow()
assert wf.last_version_run is None
wf.run(cb)
wf = Workflow()
assert wf.last_version_run == Version(vstr)
wf.reset()
示例13: test_update
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_update(self):
"""Workflow update methods"""
# Initialise with outdated version
wf = Workflow(update_settings={
'github_slug': 'deanishe/alfred-workflow-dummy',
'version': 'v2.0',
'frequency': 1,
})
# Check won't have completed yet
self.assertFalse(wf.update_available)
# wait for background update check
self.assertTrue(is_running('__workflow_update_check'))
while is_running('__workflow_update_check'):
time.sleep(0.05)
# There *is* a newer version in the repo
self.assertTrue(wf.update_available)
# Mock out subprocess and check the correct command is run
c = WorkflowMock()
with c:
self.assertTrue(wf.start_update())
# wf.logger.debug('start_update : {}'.format(c.cmd))
self.assertEquals(c.cmd[0], '/usr/bin/python')
self.assertEquals(c.cmd[2], '__workflow_update_install')
# Grab the updated release data, then reset the cache
update_info = wf.cached_data('__workflow_update_status')
wf.reset()
# Initialise with latest available release
wf = Workflow(update_settings={
'github_slug': 'deanishe/alfred-workflow-dummy',
'version': update_info['version'],
})
# Wait for background update check
self.assertTrue(is_running('__workflow_update_check'))
while is_running('__workflow_update_check'):
time.sleep(0.05)
# Remove version is same as the one we passed to Workflow
self.assertFalse(wf.update_available)
self.assertFalse(wf.start_update())
示例14: test_last_version_on
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_last_version_on(alfred4, infopl):
"""Workflow: last_version_run not empty"""
vstr = '1.9.7'
with env(alfred_workflow_version=vstr):
wf = Workflow()
wf.set_last_version(vstr)
assert Version(vstr) == wf.last_version_run
wf.reset()
# Set automatically
with env(alfred_workflow_version=vstr):
wf = Workflow()
wf.set_last_version()
assert Version(vstr) == wf.last_version_run
wf.reset()
示例15: test_last_version_set_after_run
# 需要導入模塊: from workflow.workflow import Workflow [as 別名]
# 或者: from workflow.workflow.Workflow import reset [as 別名]
def test_last_version_set_after_run(self):
"""Workflow: last_version set after `run()`"""
vstr = '1.9.7'
def cb(wf):
return
with VersionFile(vstr):
with InfoPlist():
wf = Workflow()
self.assertTrue(wf.last_version_run is None)
wf.run(cb)
wf = Workflow()
self.assertEqual(wf.last_version_run, Version(vstr))
wf.reset()