pytest fixes
pytest will automatically run/collect anything that begins with "test". Renamed a few thing to avoid false positive.
This commit is contained in:
parent
20c5ed7446
commit
bf46702374
@ -7,7 +7,7 @@ from pubs.events import Event
|
|||||||
_output = None
|
_output = None
|
||||||
|
|
||||||
|
|
||||||
class TestEvent(Event):
|
class StringEvent(Event):
|
||||||
def __init__(self, string):
|
def __init__(self, string):
|
||||||
self.string = string
|
self.string = string
|
||||||
|
|
||||||
@ -34,20 +34,20 @@ class SpecificInfo(Info):
|
|||||||
self.specific = specific
|
self.specific = specific
|
||||||
|
|
||||||
|
|
||||||
@TestEvent.listen(12, 15)
|
@StringEvent.listen(12, 15)
|
||||||
def display(TestEventInstance, nb1, nb2):
|
def display(StringEventInstance, nb1, nb2):
|
||||||
_output.append("%s %s %s"
|
_output.append("%s %s %s"
|
||||||
% (TestEventInstance.string, nb1, nb2))
|
% (StringEventInstance.string, nb1, nb2))
|
||||||
|
|
||||||
|
|
||||||
@TestEvent.listen()
|
@StringEvent.listen()
|
||||||
def hello_word(TestEventInstance):
|
def hello_word(StringEventInstance):
|
||||||
_output.append('Helloword')
|
_output.append('Helloword')
|
||||||
|
|
||||||
|
|
||||||
@TestEvent.listen()
|
@StringEvent.listen()
|
||||||
def print_it(TestEventInstance):
|
def print_it(StringEventInstance):
|
||||||
TestEventInstance.print_one()
|
StringEventInstance.print_one()
|
||||||
|
|
||||||
|
|
||||||
@AddEvent.listen()
|
@AddEvent.listen()
|
||||||
@ -56,7 +56,7 @@ def do_it(AddEventInstance):
|
|||||||
|
|
||||||
|
|
||||||
@Info.listen()
|
@Info.listen()
|
||||||
def test_info_instance(infoevent):
|
def collect_info_instance(infoevent):
|
||||||
_output.append(infoevent.info)
|
_output.append(infoevent.info)
|
||||||
if isinstance(infoevent, SpecificInfo):
|
if isinstance(infoevent, SpecificInfo):
|
||||||
_output.append(infoevent.specific)
|
_output.append(infoevent.specific)
|
||||||
@ -68,9 +68,9 @@ class TestEvents(unittest.TestCase):
|
|||||||
global _output
|
global _output
|
||||||
_output = []
|
_output = []
|
||||||
|
|
||||||
def test_listen_TestEvent(self):
|
def test_listen_StringEvent(self):
|
||||||
# using the callback system
|
# using the callback system
|
||||||
myevent = TestEvent('abcdefghijklmnopqrstuvwxyz')
|
myevent = StringEvent('abcdefghijklmnopqrstuvwxyz')
|
||||||
myevent.send() # this one call three function
|
myevent.send() # this one call three function
|
||||||
correct = ['abcdefghijklmnopqrstuvwxyz 12 15',
|
correct = ['abcdefghijklmnopqrstuvwxyz 12 15',
|
||||||
'Helloword',
|
'Helloword',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user