diff options
| author | Selwin Ong <selwin.ong@gmail.com> | 2020-10-20 06:53:36 +0700 |
|---|---|---|
| committer | Selwin Ong <selwin.ong@gmail.com> | 2020-10-20 06:53:36 +0700 |
| commit | cf36ed9b4c548390e835aa0a006e5f593fa32e26 (patch) | |
| tree | fd59f7a2965802536b47145de585bc78f0e23676 /tests/fixtures.py | |
| parent | befbbfe7ee0bb73eb043987a876651a15967c9f8 (diff) | |
| parent | 9adcd7e50c511ceba622ba20c826a0b701a917ea (diff) | |
| download | rq-pubsub.tar.gz | |
Merge branch 'master' into pubsubpubsub
Diffstat (limited to 'tests/fixtures.py')
| -rw-r--r-- | tests/fixtures.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/fixtures.py b/tests/fixtures.py index 057b932..5d8e8bc 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -10,6 +10,7 @@ import os import time import signal import sys +import subprocess from rq import Connection, get_current_job, get_current_connection, Queue from rq.decorators import job @@ -66,6 +67,17 @@ def create_file_after_timeout(path, timeout): time.sleep(timeout) create_file(path) +def create_file_after_timeout_and_setsid(path, timeout): + os.setsid() + create_file_after_timeout(path, timeout) + +def launch_process_within_worker_and_store_pid(path, timeout): + + p = subprocess.Popen(['sleep', str(timeout)]) + with open(path, 'w') as f: + f.write('{}'.format(p.pid)) + + p.wait() def access_self(): assert get_current_connection() is not None |
