32 _logger = logging.getLogger('test.preparation') |
32 _logger = logging.getLogger('test.preparation') |
33 logging.basicConfig(level=logging.INFO) |
33 logging.basicConfig(level=logging.INFO) |
34 _disable_is_relative = False |
34 _disable_is_relative = False |
35 _disable_sub_projects = False |
35 _disable_sub_projects = False |
36 |
36 |
37 # pylint: disable-msg=W0613 |
37 # pylint: disable=W0613 |
38 #these methods are all mocking/emulating the real methods in other files so need the interface to be |
38 #these methods are all mocking/emulating the real methods in other files so need the interface to be |
39 #the same and no code present hence pylint throws up warnings saying unused variables. |
39 #the same and no code present hence pylint throws up warnings saying unused variables. |
40 def _get_role_for_status(status): |
40 def _get_role_for_status(status): |
41 """ Emulate get_role_for_status method for unit testing """ |
41 """ Emulate get_role_for_status method for unit testing """ |
42 pass |
42 pass |
55 |
55 |
56 def _updateResultSimple(session): |
56 def _updateResultSimple(session): |
57 """ Emulate ccm.UpdateResultSimple method for unit testing """ |
57 """ Emulate ccm.UpdateResultSimple method for unit testing """ |
58 pass |
58 pass |
59 |
59 |
60 def _fastMaintainWorkArea(project, dir, projectname, threads): |
60 def _fastMaintainWorkArea(project, dir_, projectname, threads): |
61 """ Emulate ccm.extra.FastMaintainWorkArea method for unit testing """ |
61 """ Emulate ccm.extra.FastMaintainWorkArea method for unit testing """ |
62 pass |
62 pass |
63 |
63 |
64 def _is_same_family(self, project): |
64 def _is_same_family(self, project): |
65 """ Emulate project.is_same_family method for unit testing """ |
65 """ Emulate project.is_same_family method for unit testing """ |
364 return True |
364 return True |
365 return None |
365 return None |
366 |
366 |
367 class _config(): |
367 class _config(): |
368 """Emulating configuration class""" |
368 """Emulating configuration class""" |
369 def __init__(self, type): |
369 def __init__(self, type_): |
370 self.database = 'test' |
370 self.database = 'test' |
371 self.type = type |
371 self.type = type_ |
372 self.name = 'test' |
372 self.name = 'test' |
373 self.data = {'database': 'test'} |
373 self.data = {'database': 'test'} |
374 self.data['dir'] = tempfile.gettempdir() |
374 self.data['dir'] = tempfile.gettempdir() |
375 self.data['release'] = None |
375 self.data['release'] = None |
376 self.threads = 1 |
376 self.threads = 1 |
433 |
433 |
434 def has_key(self, key): |
434 def has_key(self, key): |
435 """ Check if key exists. """ |
435 """ Check if key exists. """ |
436 return self.data.has_key(key) |
436 return self.data.has_key(key) |
437 |
437 |
438 # pylint: disable-msg=W0613 |
438 # pylint: disable=W0613 |
439 #need disable msg to prevent pylint warning as this is emulating the real method. |
439 #need disable msg to prevent pylint warning as this is emulating the real method. |
440 def create(self, fpn): |
440 def create(self, fpn): |
441 """Emulating session.create method""" |
441 """Emulating session.create method""" |
442 return _project() |
442 return _project() |
443 # pylint: enable-msg=W0613 |
443 # pylint: enable-msg=W0613 |
444 |
444 |
445 def purposes(self): |
445 def purposes(self): |
446 """Emulating session.purposes method""" |
446 """Emulating session.purposes method""" |
447 return self |
447 return self |
448 |
448 |
449 # pylint: disable-msg=W0613 |
449 # pylint: disable=W0613 |
450 #need disable msg to prevent pylint warning as this is emulating the real method. |
450 #need disable msg to prevent pylint warning as this is emulating the real method. |
451 def get_workarea_info(self, path): |
451 def get_workarea_info(self, path): |
452 """Emulating session.get_workarea_info method""" |
452 """Emulating session.get_workarea_info method""" |
453 return _getWorkAreaInfo() |
453 return _getWorkAreaInfo() |
454 # pylint: enable-msg=W0613 |
454 # pylint: enable-msg=W0613 |
463 return self.data[key] |
463 return self.data[key] |
464 |
464 |
465 class _project(): |
465 class _project(): |
466 """Emulating project class""" |
466 """Emulating project class""" |
467 def __init__(self): |
467 def __init__(self): |
468 global _disable_sub_projects |
|
469 global _disable_is_relative |
|
470 self.name = 'pyUnitTestHeliumProject' |
468 self.name = 'pyUnitTestHeliumProject' |
471 self.objectname = '1' |
469 self.objectname = '1' |
472 self.data = {'status':None} |
470 self.data = {'status':None} |
473 self.data['project'] = _subProject() |
471 self.data['project'] = _subProject() |
474 if _disable_is_relative: |
472 if _disable_is_relative: |
504 |
502 |
505 def update(self, status, replace_subprojects, update_keepgoing, result): |
503 def update(self, status, replace_subprojects, update_keepgoing, result): |
506 """Emulating project.update method""" |
504 """Emulating project.update method""" |
507 pass |
505 pass |
508 |
506 |
509 def work_area(self, boolean1, boolean2, boolean3 = None, dir=None, projectname=None ): |
507 def work_area(self, boolean1, boolean2, boolean3 = None, dir_=None, projectname=None ): |
510 """Emulating project.work_area method""" |
508 """Emulating project.work_area method""" |
511 pass |
509 pass |
512 |
510 |
513 def conflict(self, boolean, conflictsobjects): |
511 def conflict(self, boolean, conflictsobjects): |
514 """Emulating project.conflict method""" |
512 """Emulating project.conflict method""" |
515 pass |
513 pass |
516 |
514 |
517 # pylint: disable-msg=W0613 |
515 # pylint: disable=W0613 |
518 #need disable msg to prevent pylint warning as this is emulating the real method. |
516 #need disable msg to prevent pylint warning as this is emulating the real method. |
519 def checkout(self, session, version, purpose): |
517 def checkout(self, session, version, purpose): |
520 """Emulating project.checkout method""" |
518 """Emulating project.checkout method""" |
521 return _checkout() |
519 return _checkout() |
522 # pylint: enable-msg=W0613 |
520 # pylint: enable-msg=W0613 |
587 |
585 |
588 def exists(self): |
586 def exists(self): |
589 """Emulating sub project.exists """ |
587 """Emulating sub project.exists """ |
590 return True |
588 return True |
591 |
589 |
592 # pylint: disable-msg=W0613 |
590 # pylint: disable=W0613 |
593 #need disable msg to prevent pylint warning as this is emulating the real method. |
591 #need disable msg to prevent pylint warning as this is emulating the real method. |
594 def checkout(self, session, version, purpose, subprojects=None): |
592 def checkout(self, session, version, purpose, subprojects=None): |
595 """Emulating sub project.checkout """ |
593 """Emulating sub project.checkout """ |
596 return _checkout() |
594 return _checkout() |
597 |
595 |