Skip to content

Commit

Permalink
use worker.pid in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cenkalti committed Nov 1, 2016
1 parent ea719dd commit b385270
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/integration/test_worker.py
Expand Up @@ -10,7 +10,7 @@
from kuyruk import Kuyruk
from kuyruk.exceptions import ResultTimeout, RemoteException
from tests import tasks
from tests.integration.util import run_worker, get_pid, delete_queue, len_queue
from tests.integration.util import run_worker, delete_queue, len_queue
from tests.integration.util import drop_connections


Expand Down Expand Up @@ -89,8 +89,7 @@ def test_worker_sigquit(self):
tasks.loop_forever()
with run_worker() as worker:
worker.expect('looping forever')
pid = get_pid('kuyruk: worker')
os.kill(pid, signal.SIGUSR2)
os.kill(worker.pid, signal.SIGUSR2)
worker.expect('Dropping current task')
assert len_queue("kuyruk") == 0, worker.get_output()

Expand Down Expand Up @@ -176,8 +175,7 @@ def test_sigint(self):
tasks.just_sleep(10)
with run_worker(terminate=False) as worker:
worker.expect('Processing task')
pid = get_pid('kuyruk: worker')
os.kill(pid, signal.SIGINT)
os.kill(worker.pid, signal.SIGINT)
worker.expect('Task is successful')
worker.expect_exit(0)
assert len_queue("kuyruk") == 0, worker.get_output()
Expand All @@ -186,6 +184,5 @@ def test_sigusr1(self):
"""Print stacktrace on SIGUSR1"""
with run_worker() as worker:
worker.expect('Consumer started')
pid = get_pid('kuyruk: worker')
os.kill(pid, signal.SIGUSR1)
os.kill(worker.pid, signal.SIGUSR1)
worker.expect('traceback.format_stack')

0 comments on commit b385270

Please sign in to comment.