def cuda_sensitive_mtime(x):
    """
    Return a key for sorting tests bases on mtime and test name. For CUDA
    tests, interleaving tests from different classes is dangerous as the CUDA
    context might get reset unexpectedly between methods of a class, so for
    CUDA tests the key prioritises the test module and class ahead of the
    mtime.
    """
    cls = x.__class__
    key = _get_mtime(cls) + str(x)

    from numba.cuda.testing import CUDATestCase
    if CUDATestCase in cls.mro():
        key = "%s.%s %s" % (str(cls.__module__), str(cls.__name__), key)

    return key

    Return a key for sorting tests bases on mtime and test name. For CUDA
    tests, interleaving tests from different classes is dangerous as the CUDA
    context might get reset unexpectedly between methods of a class, so for
    CUDA tests the key prioritises the test module and class ahead of the
    mtime.
    
numba/testing/main.py