def test_submit_jobid2(mock_ssh): """ Test if Jobsubmit exception is triggered if job id can't be grabbed. """ job = {"destdir": "/path/to/destdir", "subfile": "submit.file"} mock_ssh.return_value = ("success", "", 0) with pytest.raises(exceptions.JobsubmitError): submit(job)
def test_submit_jobid1(mock_ssh): """ Test if job id is grabbed. """ job = {"destdir": "/path/to/destdir", "subfile": "submit.file"} mock_ssh.return_value = ("submitted with id 12345.sdb", "", 0) submit(job) assert job["jobid"] == "12345"
def test_submit_except8(mock_ssh): """ Check that jobsubmit exception is raised on generic SSH failure. """ job = {"destdir": "/path/to/destdir", "subfile": "submit.file"} mock_ssh.side_effect = exceptions.SSHError("Error", ("out", "err", 0)) mock_ssh.return_value = ("success", "error", 0) with pytest.raises(exceptions.JobsubmitError): submit(job)
def test_submit_except6(mock_ssh): """ Check that the jobsubmit error is triggered based on certain output. """ job = {"destdir": "/path/to/destdir", "subfile": "submit.file"} mock_ssh.side_effect = exceptions.SSHError("Error", ("out", "budget", 0)) mock_ssh.return_value = ("success", "Error", 0) with pytest.raises(exceptions.JobsubmitError): submit(job)
def test_submit_except1(mock_ssh): """ Test if Queuemax exception is triggered based on output from scheduler. """ job = {"destdir": "/path/to/destdir", "subfile": "submit.file"} mock_ssh.side_effect = exceptions.SSHError( "Error", ("out", "would exceed queue's generic per-user limit", 0)) mock_ssh.return_value = ("success", "Error", 0) with pytest.raises(exceptions.QueuemaxError): submit(job)