def test_run_working_directory_changes_force(self): tool = MockTool() tool._scm = Mock() step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=True)) tool._scm.has_working_directory_changes = lambda: True step.run({}) self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 1)
def test_no_clean(self): tool = MockTool() tool._scm = Mock() step = CleanWorkingDirectory(tool, MockOptions(clean=False)) step.run({}) self.assertEqual( tool._scm.discard_working_directory_changes.call_count, 0)
def test_no_clean(self): tool = MockTool() tool._scm = Mock() step = CleanWorkingDirectory(tool, MockOptions(clean=False)) step.run({}) self.assertEqual(tool._scm.ensure_no_local_commits.call_count, 0) self.assertEqual(tool._scm.ensure_clean_working_directory.call_count, 0)
def test_no_clean(self): tool = MockTool() step = CleanWorkingDirectory(tool, MockOptions(clean=False)) step.run({}) self.assertEqual(tool._scm.ensure_no_local_commits.call_count, 0) self.assertEqual(tool._scm.ensure_clean_working_directory.call_count, 0)
def test_run(self): tool = MockTool() tool._scm = Mock() tool._scm.checkout_root = '/mock-checkout' step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=False)) step.run({}) self.assertEqual(tool._scm.ensure_no_local_commits.call_count, 1) self.assertEqual(tool._scm.ensure_clean_working_directory.call_count, 1)
def test_run(self): tool = MockTool() tool._scm = Mock() tool._scm.checkout_root = '/mock-checkout' step = CleanWorkingDirectory( tool, MockOptions(clean=True, force_clean=False)) step.run({}) self.assertEqual(tool._scm.ensure_no_local_commits.call_count, 1) self.assertEqual(tool._scm.ensure_clean_working_directory.call_count, 1)
def __init__(self, tool, options): # FIXME: This a bit of a hack. Consider doing this more cleanly. CleanWorkingDirectory.__init__(self, tool, options, allow_local_commits=True)
def test_no_clean(self): tool = MockTool() tool._scm = Mock() step = CleanWorkingDirectory(tool, MockOptions(clean=False)) step.run({}) self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 0)