Ejemplo n.º 1
0
def simple_project():
    """build a simple project for testing the Project class

        parent (inge1/1, inge2/1)
          |
          |--- child1 (inge1/1), 10
          |
          |--- child2
          |      |
          |      |--- child2_1 (inge1/0.6), 5
          |      |
          |      `--- child2_2 (inge2/1), 12
          |
          `--- stone [milestone]"""
    # create project
    project = Project()
    # create tasks
    project.root_task = parent = Task('parent')
    child1 = Task('child1')
    child2 = Task('child2')
    child2_1 = Task('child2_1')
    child2_2 = Task('child2_2')
    stone = MileStone('stone')
    project.milestones['stone'] = stone
    # building tree
    parent.append(child1)
    parent.append(child2)
    child2.append(child2_1)
    child2.append(child2_2)
    parent.append(stone)
    # set duration
    child1.duration = 10
    child2_1.duration = 5
    child2_2.duration = 12
    # calendar
    calendar = Calendar('typic', 'Typical Calendar')
    project.calendars['typic'] = calendar
    cdp = ResourceRole('cdp', 'Chef', 100.0, 'EUR')
    ingpy = ResourceRole('ingpy', 'Python Developper', 80.0, 'EUR')
    ingihm = ResourceRole('ingihm', 'Human Interface Ingineer', 70.0, 'EUR')
    toto = Resource('toto', 'Mike', calendar, [cdp, ingpy])
    tata = Resource('tata', 'Mila', calendar, [ingpy, ingihm])
    project.resources_roles = dict(cdp=cdp, ingpy=ingpy, ingihm=ingihm)
    roles = (cdp, ingpy, ingihm)
    project.resources['toto'] = toto
    project.resources['tata'] = tata
    resources = (tata, toto)
    tasks = (parent, child1, child2, child2_1, child2_2)
    return project, tasks, resources, roles, stone, calendar
Ejemplo n.º 2
0
 def test_get_progress(self):
     """tests progress' getter"""
     t = Task('hello')
     t.duration = 10
     self.assertEqual(t.progress, 0.)
     #activity = [100, DateTime(2005, 8, 1), DateTime(2005, 8, 4)]
     #
     #self.assertEqual(t.progress, 0.4)
     t.progress = 0.8
     self.assertEqual(t.progress, 0.8)