def test_init_check():
    """Check the queue is empty first"""
    cur_list = rq.registry.StartedJobRegistry(queue=q).get_job_ids()
    if len(cur_list) > 0:
        try:
            job_id = cur_list[0]
            logger.info('Deleting job: {:s}'.format(job_id))
            job = q.fetch_job(job_id)
            job.meta['CrackQ State'] = 'Stop'
            job.save_meta()
            time.sleep(5)
            counter = 0
            while len(cur_list) > 0 and counter < 9:
                cur_list = rq.registry.StartedJobRegistry(queue=q).get_job_ids()
                time.sleep(5)
                counter += 2
            job.delete()
            time.sleep(21)
            comp_list = crack_q.check_complete(q)
            assert job_id not in comp_list
            assert len(cur_list) < 1
        except AttributeError as err:
            logger.error('Failed to delete job: {}'.format(err))
    assert len(cur_list) < 1
Check the queue is empty first
crackq/tests/test_queue.py