Rename TestSkill* to remove warning in pytest
parent
c14daa5844
commit
e302821147
|
@ -231,7 +231,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
|
|
||||||
def test_register_intent(self):
|
def test_register_intent(self):
|
||||||
# Test register Intent object
|
# Test register Intent object
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.initialize()
|
s.initialize()
|
||||||
expected = [{'at_least_one': [],
|
expected = [{'at_least_one': [],
|
||||||
|
@ -241,7 +241,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
self.check_register_intent(expected)
|
self.check_register_intent(expected)
|
||||||
|
|
||||||
# Test register IntentBuilder object
|
# Test register IntentBuilder object
|
||||||
s = TestSkill2()
|
s = SimpleSkill2()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.initialize()
|
s.initialize()
|
||||||
expected = [{'at_least_one': [],
|
expected = [{'at_least_one': [],
|
||||||
|
@ -253,14 +253,14 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
|
|
||||||
# Test register IntentBuilder object
|
# Test register IntentBuilder object
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
s = TestSkill3()
|
s = SimpleSkill3()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.initialize()
|
s.initialize()
|
||||||
|
|
||||||
def test_enable_disable_intent(self):
|
def test_enable_disable_intent(self):
|
||||||
"""Test disable/enable intent."""
|
"""Test disable/enable intent."""
|
||||||
# Setup basic test
|
# Setup basic test
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.initialize()
|
s.initialize()
|
||||||
expected = [{'at_least_one': [],
|
expected = [{'at_least_one': [],
|
||||||
|
@ -278,7 +278,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
def test_register_vocab(self):
|
def test_register_vocab(self):
|
||||||
"""Test disable/enable intent."""
|
"""Test disable/enable intent."""
|
||||||
# Setup basic test
|
# Setup basic test
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.initialize()
|
s.initialize()
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
self.emitter.reset()
|
self.emitter.reset()
|
||||||
|
|
||||||
def test_register_intent_file(self):
|
def test_register_intent_file(self):
|
||||||
s = TestSkill4()
|
s = SimpleSkill4()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.vocab_dir = join(dirname(__file__), 'intent_file')
|
s.vocab_dir = join(dirname(__file__), 'intent_file')
|
||||||
s.initialize()
|
s.initialize()
|
||||||
|
@ -334,8 +334,8 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
""" Test decorated intents """
|
""" Test decorated intents """
|
||||||
path_orig = sys.path
|
path_orig = sys.path
|
||||||
sys.path.append(abspath(dirname(__file__)))
|
sys.path.append(abspath(dirname(__file__)))
|
||||||
TestSkill5 = __import__('decorator_test_skill').TestSkill
|
SimpleSkill5 = __import__('decorator_test_skill').TestSkill
|
||||||
s = TestSkill5()
|
s = SimpleSkill5()
|
||||||
s.vocab_dir = join(dirname(__file__), 'intent_file')
|
s.vocab_dir = join(dirname(__file__), 'intent_file')
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.initialize()
|
s.initialize()
|
||||||
|
@ -352,7 +352,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
self.check_register_decorators(expected)
|
self.check_register_decorators(expected)
|
||||||
|
|
||||||
def test_failing_set_context(self):
|
def test_failing_set_context(self):
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
s.set_context(1)
|
s.set_context(1)
|
||||||
|
@ -369,7 +369,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
sorted(result_list))
|
sorted(result_list))
|
||||||
self.emitter.reset()
|
self.emitter.reset()
|
||||||
|
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
# No context content
|
# No context content
|
||||||
s.set_context('TurtlePower')
|
s.set_context('TurtlePower')
|
||||||
|
@ -389,7 +389,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
self.emitter.reset()
|
self.emitter.reset()
|
||||||
|
|
||||||
def test_failing_remove_context(self):
|
def test_failing_remove_context(self):
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
s.remove_context(1)
|
s.remove_context(1)
|
||||||
|
@ -402,7 +402,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
sorted(result_list))
|
sorted(result_list))
|
||||||
self.emitter.reset()
|
self.emitter.reset()
|
||||||
|
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(self.emitter)
|
s.bind(self.emitter)
|
||||||
s.remove_context('Donatello')
|
s.remove_context('Donatello')
|
||||||
expected = [{'context': 'Donatello'}]
|
expected = [{'context': 'Donatello'}]
|
||||||
|
@ -410,7 +410,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
|
|
||||||
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
||||||
def test_skill_location(self):
|
def test_skill_location(self):
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
self.assertEqual(s.location, BASE_CONF.get('location'))
|
self.assertEqual(s.location, BASE_CONF.get('location'))
|
||||||
self.assertEqual(s.location_pretty,
|
self.assertEqual(s.location_pretty,
|
||||||
BASE_CONF['location']['city']['name'])
|
BASE_CONF['location']['city']['name'])
|
||||||
|
@ -420,7 +420,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
||||||
def test_add_event(self):
|
def test_add_event(self):
|
||||||
emitter = mock.MagicMock()
|
emitter = mock.MagicMock()
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(emitter)
|
s.bind(emitter)
|
||||||
s.add_event('handler1', s.handler)
|
s.add_event('handler1', s.handler)
|
||||||
# Check that the handler was registered with the emitter
|
# Check that the handler was registered with the emitter
|
||||||
|
@ -431,7 +431,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
||||||
def test_remove_event(self):
|
def test_remove_event(self):
|
||||||
emitter = mock.MagicMock()
|
emitter = mock.MagicMock()
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(emitter)
|
s.bind(emitter)
|
||||||
s.add_event('handler1', s.handler)
|
s.add_event('handler1', s.handler)
|
||||||
self.assertTrue('handler1' in zip(*s.events)[0])
|
self.assertTrue('handler1' in zip(*s.events)[0])
|
||||||
|
@ -445,7 +445,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
||||||
def test_add_scheduled_event(self):
|
def test_add_scheduled_event(self):
|
||||||
emitter = mock.MagicMock()
|
emitter = mock.MagicMock()
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(emitter)
|
s.bind(emitter)
|
||||||
s.schedule_event(s.handler, datetime.now(), name='sched_handler1')
|
s.schedule_event(s.handler, datetime.now(), name='sched_handler1')
|
||||||
# Check that the handler was registered with the emitter
|
# Check that the handler was registered with the emitter
|
||||||
|
@ -455,7 +455,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
||||||
def test_remove_scheduled_event(self):
|
def test_remove_scheduled_event(self):
|
||||||
emitter = mock.MagicMock()
|
emitter = mock.MagicMock()
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
s.bind(emitter)
|
s.bind(emitter)
|
||||||
s.schedule_event(s.handler, datetime.now(), name='sched_handler1')
|
s.schedule_event(s.handler, datetime.now(), name='sched_handler1')
|
||||||
# Check that the handler was registered with the emitter
|
# Check that the handler was registered with the emitter
|
||||||
|
@ -468,7 +468,7 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
@mock.patch.dict(Configuration._Configuration__config, BASE_CONF)
|
||||||
def test_run_scheduled_event(self):
|
def test_run_scheduled_event(self):
|
||||||
emitter = mock.MagicMock()
|
emitter = mock.MagicMock()
|
||||||
s = TestSkill1()
|
s = SimpleSkill1()
|
||||||
with mock.patch.object(s, '_settings',
|
with mock.patch.object(s, '_settings',
|
||||||
create=True, value=mock.MagicMock()):
|
create=True, value=mock.MagicMock()):
|
||||||
s.bind(emitter)
|
s.bind(emitter)
|
||||||
|
@ -482,9 +482,9 @@ class MycroftSkillTest(unittest.TestCase):
|
||||||
self.assertTrue('0:sched_handler1' not in zip(*s.events)[0])
|
self.assertTrue('0:sched_handler1' not in zip(*s.events)[0])
|
||||||
|
|
||||||
|
|
||||||
class TestSkill1(MycroftSkill):
|
class SimpleSkill1(MycroftSkill):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(TestSkill1, self).__init__()
|
super(SimpleSkill1, self).__init__()
|
||||||
self.handler_run = False
|
self.handler_run = False
|
||||||
|
|
||||||
""" Test skill for normal intent builder syntax """
|
""" Test skill for normal intent builder syntax """
|
||||||
|
@ -499,7 +499,7 @@ class TestSkill1(MycroftSkill):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestSkill2(MycroftSkill):
|
class SimpleSkill2(MycroftSkill):
|
||||||
""" Test skill for intent builder without .build() """
|
""" Test skill for intent builder without .build() """
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
i = IntentBuilder('a').require('Keyword')
|
i = IntentBuilder('a').require('Keyword')
|
||||||
|
@ -512,7 +512,7 @@ class TestSkill2(MycroftSkill):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestSkill3(MycroftSkill):
|
class SimpleSkill3(MycroftSkill):
|
||||||
""" Test skill for invalid Intent for register_intent """
|
""" Test skill for invalid Intent for register_intent """
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.register_intent('string', self.handler)
|
self.register_intent('string', self.handler)
|
||||||
|
@ -524,7 +524,7 @@ class TestSkill3(MycroftSkill):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestSkill4(MycroftSkill):
|
class SimpleSkill4(MycroftSkill):
|
||||||
""" Test skill for padatious intent """
|
""" Test skill for padatious intent """
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.register_intent_file('test.intent', self.handler)
|
self.register_intent_file('test.intent', self.handler)
|
||||||
|
|
Loading…
Reference in New Issue