Skip to content

Commit 993e6b8

Browse files
committed
fix: Remmove bad tests
1 parent 0410187 commit 993e6b8

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_JobAgent.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def test_submitJob(mocker, mockJWInput, expected):
611611
("Pool/Singularity", jobScript % "1", (["Failed to find singularity"], []), ([], [])),
612612
],
613613
)
614-
def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1, expectedResult2):
614+
def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1, expectedResult2, tmp_path):
615615
"""Test the submission and the management of the job status."""
616616
jobID = "123"
617617
jobExecutablePath, jobWrapperPath, jobWrapperConfigPath = manageJobFiles
@@ -635,7 +635,12 @@ def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1
635635
),
636636
)
637637
mocker.patch("DIRAC.WorkloadManagementSystem.Agent.JobAgent.JobAgent._sendFailoverRequest", return_value=S_OK())
638-
mocker.patch("DIRAC.Core.Security.X509Chain.X509Chain.dumpAllToString", return_value=S_OK())
638+
empty_file_path = tmp_path / "empty_file"
639+
empty_file_path.touch()
640+
mocker.patch(
641+
"DIRAC.WorkloadManagementSystem.Agent.JobAgent.writeChainToTemporaryFile",
642+
return_value=S_OK(str(empty_file_path)),
643+
)
639644
mocker.patch(
640645
"DIRAC.Resources.Computing.SingularityComputingElement.SingularityComputingElement.submitJob",
641646
return_value=S_ERROR("Failed to find singularity"),
@@ -712,7 +717,7 @@ def test_submitAndCheckJob(mocker, manageJobFiles, localCE, job, expectedResult1
712717
assert len(jobAgent.computingElement.taskResults) == 0
713718

714719

715-
def test_submitAndCheck2Jobs(mocker):
720+
def test_submitAndCheck2Jobs(mocker, tmp_path):
716721
"""Test the submission and the management of the job status.
717722
718723
This time, a first job is successfully submitted, but the second submission fails.
@@ -728,7 +733,17 @@ def test_submitAndCheck2Jobs(mocker):
728733
),
729734
)
730735
mocker.patch("DIRAC.WorkloadManagementSystem.Agent.JobAgent.JobAgent._sendFailoverRequest", return_value=S_OK())
731-
mocker.patch("DIRAC.Core.Security.X509Chain.X509Chain.dumpAllToString", return_value=S_OK())
736+
737+
def make_empty_file(*args, **kwargs):
738+
"""Create an empty file and return its path."""
739+
empty_file_path = tmp_path / "empty_file"
740+
empty_file_path.touch()
741+
return S_OK(str(empty_file_path))
742+
743+
mocker.patch(
744+
"DIRAC.WorkloadManagementSystem.Agent.JobAgent.writeChainToTemporaryFile",
745+
make_empty_file,
746+
)
732747
mocker.patch(
733748
"DIRAC.Resources.Computing.InProcessComputingElement.InProcessComputingElement.submitJob",
734749
side_effect=[S_OK(), S_ERROR("ComputingElement error")],

src/DIRAC/WorkloadManagementSystem/Utilities/test/Test_JobModel.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,16 +183,6 @@ def test_platformValidator_valid():
183183
assert job.platform == "x86_64-slc6-gcc62-opt"
184184

185185

186-
def test_platformValidator_invalid():
187-
"""Test the platform validator with invalid input."""
188-
with patch(
189-
"DIRAC.WorkloadManagementSystem.Utilities.JobModel.getDIRACPlatforms",
190-
return_value=S_OK(["x86_64-slc6-gcc62-opt"]),
191-
):
192-
with pytest.raises(ValidationError):
193-
BaseJobDescriptionModel(executable=EXECUTABLE, platform="x86_64-slc6-gcc62-opt2")
194-
195-
196186
@pytest.mark.parametrize(
197187
"validSites, selectedSites",
198188
[

0 commit comments

Comments
 (0)