Changeset 64
- Timestamp:
- Feb 23, 2010 11:23:45 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mergebot/trunk/utils/test.py
r63 r64 5 5 to be reworked to be less cumbersome.) 6 6 """ 7 8 # TODO: The testcases need to be extended to cover the following: 9 # - using a ticket #number as a version 10 # - using a release version number as a version 11 # - verify inter-ticket dependency checking 12 # - verify failure cascades through inter-ticket dependencies 7 13 8 14 import os … … 214 220 self.assertEqual(retval, 0, "svn checkout failed with error %s" % (retval)) 215 221 222 def cleanup(self): 223 shutil.rmtree(self.get_workdir()) 224 216 225 def switch(self, ticket_id=None): 217 226 if ticket_id is None: … … 326 335 self._tester.merge(ticket_id, 'stuff') 327 336 337 self.cleanup() 328 338 329 339 class MergeBotTestMergeWithChangeAndTrunkChange(FunctionalSvnTestCaseSetup): … … 374 384 self._tester.merge_conflict(ticket_id, 'stuff') 375 385 386 self.cleanup() 387 376 388 377 389 class MergeBotTestMergeWithPropertyConflict(FunctionalSvnTestCaseSetup): … … 401 413 self._tester.merge_conflict(ticket_id, 'stuff') 402 414 415 self.cleanup() 416 403 417 404 418 class MergeBotTestMergeWithPropertyBranchDeleteConflict(FunctionalSvnTestCaseSetup): … … 428 442 self._tester.merge_conflict(ticket_id, 'stuff') 429 443 444 self.cleanup() 445 430 446 431 447 class MergeBotTestMergeWithPropertyTrunkDeleteConflict(FunctionalSvnTestCaseSetup): … … 455 471 self._tester.merge_conflict(ticket_id, 'stuff') 456 472 473 self.cleanup() 474 457 475 458 476 class MergeBotTestMergeWithBranchRenameConflict(FunctionalSvnTestCaseSetup): … … 481 499 482 500 self._tester.merge_conflict(ticket_id, 'stuff') 501 502 self.cleanup() 483 503 484 504 … … 509 529 # make sure it finds the conflict 510 530 self._tester.merge_conflict(ticket_id, 'stuff') 531 532 self.cleanup() 511 533 512 534 … … 534 556 535 557 self._tester.rebranch(ticket_id, 'stuff') 558 self.cleanup() 536 559 537 560 … … 554 577 555 578 self._tester.rebranch(ticket_id, 'stuff') 579 self.cleanup() 556 580 557 581 … … 582 606 # rebranch, make sure it shows a conflict 583 607 self._tester.rebranch_conflict(ticket_id, 'stuff') 608 609 self.cleanup() 584 610 585 611 … … 610 636 self._tester.rebranch_conflict(ticket_id, 'stuff') 611 637 638 self.cleanup() 639 612 640 613 641 class MergeBotTestRebranchWithPropertyBranchDeleteConflict(FunctionalSvnTestCaseSetup): … … 637 665 self._tester.rebranch_conflict(ticket_id, 'stuff') 638 666 667 self.cleanup() 668 639 669 640 670 class MergeBotTestRebranchWithPropertyTrunkDeleteConflict(FunctionalSvnTestCaseSetup): … … 664 694 self._tester.rebranch_conflict(ticket_id, 'stuff') 665 695 696 self.cleanup() 697 666 698 667 699 class MergeBotTestRebranchWithBranchRenameConflict(FunctionalSvnTestCaseSetup): … … 690 722 691 723 self._tester.rebranch_conflict(ticket_id, 'stuff') 724 725 self.cleanup() 692 726 693 727 … … 719 753 self._tester.rebranch_conflict(ticket_id, 'stuff') 720 754 721 722 class MergeBotTestSingleUseCase(FunctionalTwillTestCaseSetup): 755 self.cleanup() 756 757 758 class MergeBotTestSingleUseCase(FunctionalSvnTestCaseSetup): 723 759 def runTest(self): 724 760 """Create a branch, make a change, checkmerge, and merge it.""" … … 727 763 self._tester.branch(ticket_id, 'stuff') 728 764 # checkout a working copy & make a change 729 svnurl = self._testenv.repo_url() 730 workdir = os.path.join(self._testenv.dirname, self.__class__.__name__) 731 retval = call(['svn', 'checkout', svnurl + '/stuff/branches/ticket-%s' % ticket_id, workdir], 732 stdout=logfile, stderr=logfile) 733 self.assertEqual(retval, 0, "svn checkout failed with error %s" % (retval)) 765 self.checkout(ticket_id) 734 766 # Create & add a new file 735 newfile = os.path.join(workdir, self.__class__.__name__) 736 open(newfile, 'w').write(random_page()) 737 retval = call(['svn', 'add', self.__class__.__name__], 738 cwd=workdir, 739 stdout=logfile, stderr=logfile) 740 self.assertEqual(retval, 0, "svn add failed with error %s" % (retval)) 741 retval = call(['svn', 'commit', '-m', 'Add a new file', self.__class__.__name__], 742 cwd=workdir, 743 stdout=logfile, stderr=logfile) 744 self.assertEqual(retval, 0, "svn commit failed with error %s" % (retval)) 745 767 self.add_new_file() 768 self.commit('Add a new file') 746 769 self._tester.checkmerge(ticket_id, 'stuff') 747 770 self._tester.merge(ticket_id, 'stuff') 748 749 shutil.rmtree(workdir) # cleanup working copy 771 self.cleanup() 772 773 774 class MergeBotTestBranchReuse(FunctionalSvnTestCaseSetup): 775 def runTest(self): 776 """Merge a branch, branch it again, and merge it a second time.""" 777 ticket_id = self._tester.create_ticket(summary=self.__class__.__name__, 778 info={'component':'stuff', 'version':'trunk'}) 779 basename = self.__class__.__name__ 780 781 self.checkout() 782 self.add_new_file(basename) 783 self.commit('Add a new file') 784 785 self._tester.branch(ticket_id, 'stuff') 786 self.switch(ticket_id) 787 open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence()) 788 self.commit('Make a modification') 789 self._tester.merge(ticket_id, 'stuff') 790 791 self._tester.branch(ticket_id, 'stuff') 792 self.switch(ticket_id) 793 open(os.path.join(self.get_workdir(), basename), 'a').write(random_sentence()) 794 self.commit('Make a second modification') 795 self._tester.merge(ticket_id, 'stuff') 796 self.cleanup() 750 797 751 798 … … 775 822 suite.addTest(MergeBotTestMergeWithPropertyTrunkDeleteConflict()) 776 823 suite.addTest(MergeBotTestSingleUseCase()) 824 suite.addTest(MergeBotTestBranchReuse()) 777 825 return suite 778 826
Note: See TracChangeset
for help on using the changeset viewer.