From 985fbb31cca7b17910f3134b850554fc640aba26 Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Thu, 24 Sep 2015 11:21:28 +0200 Subject: [PATCH 1/2] tests cluster stop when already stopped --- django_q/tests/test_cluster.py | 1 + 1 file changed, 1 insertion(+) diff --git a/django_q/tests/test_cluster.py b/django_q/tests/test_cluster.py index 5f9c927..b451f35 100644 --- a/django_q/tests/test_cluster.py +++ b/django_q/tests/test_cluster.py @@ -65,6 +65,7 @@ def test_cluster_initial(broker): assert c.stop() is True assert c.sentinel.is_alive() is False assert c.has_stopped + assert c.stop() is False broker.delete_queue() From 131a37daf3300762d42f2e63c269cf561df56731 Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Thu, 24 Sep 2015 11:21:50 +0200 Subject: [PATCH 2/2] Removes Pycharm stdin bug workaround --- django_q/cluster.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/django_q/cluster.py b/django_q/cluster.py index 2aa0c13..d5ffdeb 100644 --- a/django_q/cluster.py +++ b/django_q/cluster.py @@ -13,7 +13,6 @@ standard_library.install_aliases() import importlib import signal import socket -import sys import ast from time import sleep from multiprocessing import Queue, Event, Process, Value, current_process @@ -49,12 +48,6 @@ class Cluster(object): signal.signal(signal.SIGINT, self.sig_handler) def start(self): - # This is just for PyCharm to not crash. Ignore it. - if not hasattr(sys.stdin, 'close'): - def dummy_close(): - pass - - sys.stdin.close = dummy_close # Start Sentinel self.stop_event = Event() self.start_event = Event() @@ -150,12 +143,6 @@ class Sentinel(object): """ :type target: function or class """ - # This is just for PyCharm to not crash. Ignore it. - if not hasattr(sys.stdin, 'close'): - def dummy_close(): - pass - - sys.stdin.close = dummy_close p = Process(target=target, args=args) p.daemon = True if target == worker: