'Test fork detection.'

@unittest.skipUnless(has_mp_get_context, 'requires    mp.get_context')
@unittest.skipUnless(is_unix, 'requires    Unix')
def test_fork(self):

    cuda.current_context()
    ctx = mp.get_context('fork')
    q = ctx.Queue()
    proc = ctx.Process(target=fork_test, args=[q])
    proc.start()
    exc = q.get()
    proc.join()
    self.assertIsNotNone(exc)
    self.assertIn('CUDA    initialized    before    forking', str(exc))
