예제 #1
0
    def testGetJobs(self):
        """
        _testGetJobs_

        Verify that the getJobs() method of the JobGroup class returns the
        correct output for each output container type it supports.
        """
        testJobA = Job()
        testJobB = Job()
        testJobGroup = JobGroup(jobs=[testJobA, testJobB])
        testJobGroup.commit()

        assert len(testJobGroup.getJobs()) == 2, "ERROR: Wrong number of jobs in job group"

        goldenJobs = [testJobA, testJobB]
        for job in testJobGroup.getJobs():
            assert job in goldenJobs, "ERROR: Unknown Job in JobGroup."

            goldenJobs.remove(job)

        assert len(goldenJobs) == 0, "ERROR: Jobs are missing from the JobGroup."

        goldenIDs = []
        goldenIDs.append(testJobA["id"])
        goldenIDs.append(testJobB["id"])
        for jobID in testJobGroup.getJobs(type="id"):
            assert jobID in goldenIDs, "ERROR: Unknown JobID in JobGroup"

            goldenIDs.remove(jobID)

        assert len(goldenIDs) == 0, "ERROR: Job IDs are missing from the JobGroup."

        return
예제 #2
0
파일: JobGroup_t.py 프로젝트: vytjan/WMCore
    def testAddCommit(self):
        """
        _testAddCommit_

        Test the add() and commit() methods of the JobGroup class.  Verify that
        jobs are not returned from getJobs() until commit() has been called.
        """
        testJob = Job()
        testJobGroup = JobGroup()

        assert len(testJobGroup.getJobs()) == 0, \
            "ERROR: JobGroup has jobs before jobs have been added."

        testJobGroup.add(testJob)

        assert len(testJobGroup.getJobs()) == 0, \
            "ERROR: JobGroup has jobs commit() was called."

        testJobGroup.commit()

        assert len(testJobGroup.getJobs()) == 1, \
            "ERROR: JobGroup has wrong number of jobs."
        assert testJob in testJobGroup.getJobs(), \
            "ERROR: JobGroup has unknown jobs."

        return
예제 #3
0
    def testAddCommit(self):
        """
        _testAddCommit_

        Test the add() and commit() methods of the JobGroup class.  Verify that
        jobs are not returned from getJobs() until commit() has been called.
        """
        testJob = Job()
        testJobGroup = JobGroup()

        assert len(testJobGroup.getJobs()) == 0, \
            "ERROR: JobGroup has jobs before jobs have been added."

        testJobGroup.add(testJob)

        assert len(testJobGroup.getJobs()) == 0, \
            "ERROR: JobGroup has jobs commit() was called."

        testJobGroup.commit()

        assert len(testJobGroup.getJobs()) == 1, \
            "ERROR: JobGroup has wrong number of jobs."
        assert testJob in testJobGroup.getJobs(), \
            "ERROR: JobGroup has unknown jobs."

        return
예제 #4
0
파일: JobGroup_t.py 프로젝트: vytjan/WMCore
    def testGetJobs(self):
        """
        _testGetJobs_

        Verify that the getJobs() method of the JobGroup class returns the
        correct output for each output container type it supports.
        """
        testJobA = Job()
        testJobB = Job()
        testJobGroup = JobGroup(jobs = [testJobA, testJobB])
        testJobGroup.commit()

        assert len(testJobGroup.getJobs()) == 2,  \
            "ERROR: Wrong number of jobs in job group"

        goldenJobs = [testJobA, testJobB]
        for job in testJobGroup.getJobs():
            assert job in goldenJobs, \
                "ERROR: Unknown Job in JobGroup."

            goldenJobs.remove(job)

        assert len(goldenJobs) == 0, \
            "ERROR: Jobs are missing from the JobGroup."

        goldenIDs = []
        goldenIDs.append(testJobA["id"])
        goldenIDs.append(testJobB["id"])
        for jobID in testJobGroup.getJobs(type = "id"):
            assert jobID in goldenIDs, \
                "ERROR: Unknown JobID in JobGroup"

            goldenIDs.remove(jobID)

        assert len(goldenIDs) == 0, \
            "ERROR: Job IDs are missing from the JobGroup."

        return