Skip to content

Commit

Permalink
improved the test a bit.
Browse files Browse the repository at this point in the history
and de-mystefied the `messsage_received` signal thing.
  • Loading branch information
ewerybody committed Dec 23, 2022
1 parent 2cd509c commit cb46df6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion singlesiding/singleinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class QSingleApplication(QtWidgets.QApplication):
converted into a :func:`UUID <uuid.uuid5>` before being utilized. If
you *really* wish to use your own string, set ``_app_id``.
"""
message_received = QtCore.Signal(dict)
# This can't be anything but a list of strings anyway.
message_received = QtCore.Signal(list)

composition_changed = QtCore.Signal()

Expand Down
5 changes: 3 additions & 2 deletions test/app_test_app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import json
try:
import singlesiding
except ModuleNotFoundError:
Expand All @@ -10,12 +11,12 @@


def main():
app = singlesiding.initialize('test', 'test app', '1', 'message!')
app = singlesiding.initialize('test', 'test app', '1')
return app


def _on_msg_receive(msg):
print('MSG on %s: "%s"' % (os.getpid(), msg))
print('MSG on %s: >%s< type: %s' % (os.getpid(), msg, type(msg)))


if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def test_app(self):
print('p1.pid: %s' % p1.pid)
# process 1 is onening

p2 = subprocess.Popen([sys.executable, TEST_APP_PATH])
p2 = subprocess.Popen([sys.executable, TEST_APP_PATH, 'Test123'])
print('p2.pid: %s' % p2.pid)
p2.wait(5)
self.assertFalse(_is_running(p2.pid), 'Process 2 is STILL running!')
# process 2 killed itself

p3 = subprocess.Popen([sys.executable, TEST_APP_PATH, 'random argument'])
p3 = subprocess.Popen([sys.executable, TEST_APP_PATH, 'random argument', '123'])
print('p3.pid: %s' % p3.pid)
p3.wait(5)
self.assertFalse(_is_running(p3.pid), 'Process 3 is STILL running!')
Expand Down

0 comments on commit cb46df6

Please sign in to comment.