コード例 #1
0
class ErrorXMLReaderTest(TestCase):
    def setUp(self):
        self.reader = ProjectXMLReader(None)

    def test_error_project(self):
        error_pr = osp.join(DATADIR, 'error_project.xml')
        self.assertRaises(MalformedProjectFile,
                          self.reader.read_resources_file, error_pr)

    def test_error_doubletask(self):
        root = self.reader.read_tasks(osp.join(DATADIR,
                                               'error_doubletask.xml'))
        self.assertEqual(root.check_consistency(),
                         ['Duplicate task id: double_t1_1'])

    def test_error_dtd_project(self):
        self.assertRaises(MalformedProjectFile, self.reader.read_tasks,
                          osp.join(DATADIR, 'error_dtd_project.xml'))
        reader = ProjectXMLReader(osp.join(DATADIR, 'error_dtd_projman.xml'))
        self.assertRaises(MalformedProjectFile, reader.read)

    def test_error_dtd_project_multi(self):
        try:
            self.reader.read_tasks(
                osp.join(DATADIR, 'multi_error_dtd_project.xml'))
        except MalformedProjectFile, ex:
            # more than one line of errors
            self.assertEqual(len(str(ex).split('\n')), 4)
コード例 #2
0
ファイル: main.py プロジェクト: gurneyalex/projman
 def load_project(self, fname):
     print "load project", fname
     reader = ProjectXMLReader( fname, None, True )
     try:
         self.project, self.files = reader.read()
     except MalformedProjectFile, exc:
         self.pop_up_bad_project(fname, exc)
         return
コード例 #3
0
 def run(self, args):
     """run the command with its specific arguments"""
     loglevel = LEVELS.get(self.config.verbose, logging.WARN)
     logging.basicConfig(level=loglevel)
     reader = ProjectXMLReader(self.config.project_file,
                               self.config.task_root)
     self.project, self.files = reader.read()
     self.project.factor = self.config.factorized_days
     self._run(args)
コード例 #4
0
class TaskXMLReaderTest(TestCase):
    def setUp(self):
        self.reader = ProjectXMLReader(None)
        self.root = self.reader.read_tasks(
            osp.join(DATADIR, 'multiline_tasked_project.xml'))
        #self.reader.project.root_task = self.root

    def test_multiline_project_label(self):
        expected_title = "Simplest Project with a multiline label, gosh can you believe it"
        self.assertEqual(expected_title, self.root.title)
        self.assertEqual(len(self.root.children), 3)

    def test_multiline_task_desc(self):
        task = self.root.children[0]
        expected_desc = u"Réunions de début et de fin de tranche, réunions\n      hebdomadaires, <emphasis>comptes-rendus</emphasis>, etc."
        self.assertEqual(expected_desc, task.description)

    def test_multiline_task_duration(self):
        task = self.root.children[0]
        self.assertEqual(25, task.duration)
        task = self.root.children[1]
        self.assertEqual(10.6, task.duration)
        task = self.root.children[2]
        self.assertEqual(0, task.duration)

    def test_multiline_task_progress(self):
        task = self.root.children[0]
        self.assertEqual(0, task.progress)
コード例 #5
0
 def _run(self, args):
     from projman.checker.problem_checker import Checker
     # validate xml format
     reader = ProjectXMLReader(self.config.project_file,
                               self.config.task_root)
     # validate projman problem
     check_project = Checker(self.project, self.config.verbose)
     check_project.problem_checker()
コード例 #6
0
 def _run(self, views):
     from projman.scheduling import schedule
     from projman.checker.problem_checker import Checker
     # validate projman problem
     check = Checker(self.project, self.config.verbose)
     check.problem_checker()
     if check.errors:
         return
     rounder = 0
     schedule(self.project, self.config)
     while (self.project.nb_solution == 0 and rounder < 2):
         print '\nAttention: No valid solution !'
         print "constraints with priority", self.project.priority,
         print 'are dropped ...\n'
         reader = ProjectXMLReader(self.config.project_file,
                                   self.config.task_root)
         self.project, self.files = reader.read()
         self.project.factor = self.config.factorized_days
         rounder += 1
         self.project.priority -= rounder
         schedule(self.project, self.config)
         nb_solution = self.project.nb_solution
     write_schedule_as_xml(self.files['schedule'], self.project)
コード例 #7
0
class TaskXMLReaderVirtualRootTest(TestCase):
    def setUp(self):
        self.reader = ProjectXMLReader(None, task_root='t1_1')
        self.root = self.reader.read_tasks(
            osp.join(DATADIR, 'multiline_tasked_project.xml'))

    def test_virtual_root(self):
        task = self.root
        expected_title = "Suivi de projet"
        self.assertEqual(expected_title, task.title)
        self.assertEqual(len(task.children), 0)
        expected_desc = u"Réunions de début et de fin de tranche, réunions\n      hebdomadaires, <emphasis>comptes-rendus</emphasis>, etc."
        self.assertEqual(expected_desc, task.description)
        self.assertEqual(25, task.duration)
        self.assertEqual(0, task.progress)
コード例 #8
0
 def setUp(self):
     reader = ProjectXMLReader(None)
     three_file = osp.join(DATADIR, 'three_resourced_list.xml')
     reader.read_resources_file(three_file)
     self.project = reader.project
コード例 #9
0
 def setUp(self):
     self.reader = ProjectXMLReader(None, task_root='t1_1')
     self.root = self.reader.read_tasks(
         osp.join(DATADIR, 'multiline_tasked_project.xml'))
コード例 #10
0
 def test_error_dtd_project(self):
     self.assertRaises(MalformedProjectFile, self.reader.read_tasks,
                       osp.join(DATADIR, 'error_dtd_project.xml'))
     reader = ProjectXMLReader(osp.join(DATADIR, 'error_dtd_projman.xml'))
     self.assertRaises(MalformedProjectFile, reader.read)
コード例 #11
0
 def setUp(self):
     self.reader = ProjectXMLReader(None)
コード例 #12
0
 def skipped_setUp(self):
     filename = osp.join(DATADIR, "csp_scheduling_projman.xml")
     reader = ProjectXMLReader(filename)
     self.project, files = reader.read()