def test_job_without_config_name(): class MyJob(Job): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) with pytest.raises(ValueError, match="config_name.+MyJob"): MyJob(cores=1, memory="1GB") class MyJobWithNoneConfigName(MyJob): config_name = None with pytest.raises(ValueError, match="config_name.+MyJobWithNoneConfigName"): MyJobWithNoneConfigName(cores=1, memory="1GB") with pytest.raises(ValueError, match="config_name.+MyJobWithNoneConfigName"): JobQueueCluster(job_cls=MyJobWithNoneConfigName, cores=1, memory="1GB")
def test_errors(): with pytest.raises(NotImplementedError) as info: JobQueueCluster(cores=4) assert "abstract class" in str(info.value)
def test_threads_deprecation(): with pytest.raises(ValueError) as info: JobQueueCluster(threads=4) assert all(word in str(info.value) for word in ['threads', 'core', 'processes'])
def test_errors(): match = re.compile("Job type.*job_cls", flags=re.DOTALL) with pytest.raises(ValueError, match=match): JobQueueCluster(cores=4)
def test_errors(): with pytest.raises(ValueError, match="Job type.*job_cls="): JobQueueCluster(cores=4)