from bzrlib.tests import TestCaseWithTransport from bzrlib.tests.TestUtil import TestLoader, TestSuite import os import os.path def test_suite(): module_names = [ 'bzrlib.plugins.bzrp4.tests.test_bzr2p4', 'bzrlib.plugins.bzrp4.tests.test_bzr2p4_blackbox', 'bzrlib.plugins.bzrp4.tests.test_git_p4', 'bzrlib.plugins.bzrp4.tests.test_git_p4_imported', 'bzrlib.plugins.bzrp4.tests.test_intermediate_file', 'bzrlib.plugins.bzrp4.tests.test_p4_fast_export', ] loader = TestLoader() return loader.loadTestsFromModuleNames(module_names) class TestCaseForTwoVcs(TestCaseWithTransport): def assertDirectoriesEqualModIgnored( self, lhs, rhs, lhs_ignore_dirents, rhs_ignore_dirents): for lhs_root, dirs, files in os.walk(lhs): for ignore in lhs_ignore_dirents: self._remove_without_exception(ignore, dirs) self._remove_without_exception(ignore, files) root = lhs_root[len(lhs)+1:] dirs_set = set(dirs) files_set = set(files) rhs_root = os.path.join(rhs, root) try: rhs_root, rhs_dirs, rhs_files = os.walk(rhs_root).next() for ignore in rhs_ignore_dirents: self._remove_without_exception(ignore, rhs_dirs) self._remove_without_exception(ignore, rhs_files) except StopIteration: self.fail('Could not read ' + rhs_root) self.assertEqual(0, len(dirs_set.symmetric_difference(rhs_dirs)), str(dirs) + ' != ' + str(rhs_dirs)) self.assertEqual(0, len(files_set.symmetric_difference(rhs_files)), str(files) + ' != ' + str(rhs_files)) # compare each file line-by-line, ignoring eol for file in files: self._assert_files_equal_mod_eol( os.path.join(lhs_root, file), os.path.join(rhs_root, file)) def _assert_files_equal_mod_eol(self, lhs, rhs): try: lhs_f = open(lhs, 'rb') rhs_f = open(rhs, 'rb') for lhs_line in lhs_f: rhs_line = rhs_f.next() self.assertEqual( lhs_line.rstrip('\n\r'), rhs_line.rstrip('\n\r')) try: possible_final_empty_line = rhs_f.next() assertEqual( '', possible_final_empty_line.rstrip('\n\r')) self.assertRaises(StopIteration, rhs_f.next()) except StopIteration: pass finally: lhs_f.close() rhs_f.close() @staticmethod def _remove_without_exception(item, list): if item in list: list.remove(item)
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#16 | 7356 | Matt McClure | Uses rsh P4PORT so that there's no need to explicitly start and stop a p4d server for the tests. | ||
#15 | 7149 | Matt McClure | Reduces memory usage so that p4-fast-export can handle a large number of files at a single changelist, and very large individual files. | ||
#14 | 7119 | Matt McClure | Improves the test coverage reporting by importing python modules rather than forking processes. | ||
#13 | 7092 | Matt McClure |
Converts all source files to UNIX line endings. bzr: revno 88.2.25, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sat 2008-12-27 14:36:39 -0500 |
||
#12 | 7087 | Matt McClure |
Changes the format of the change description addendum appended by p4-fast-export. Reverts the addendum appended by git-p4 to its original form. bzr: revno 88.2.20, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sun 2008-12-21 15:47:50 -0500 |
||
#11 | 7075 | Matt McClure |
I'm in the middle of changing the tagline that bzr2p4 adds to the Perforce change description. bzr: revno 88.2.8, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Tue 2008-12-02 09:43:39 -0500 |
||
#10 | 7043 | Matt McClure |
Merges changes from doc branch. bzr: revno 79, part 2 of 2 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sat 2008-11-15 12:35:42 -0500 |
||
#9 | 7038 | Matt McClure |
Adds a brief user guide. bzr: revno 77.1.1, part 3 of 3 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Fri 2008-11-14 09:58:48 -0500 |
||
#8 | 7006 | Matt McClure |
Merges mainline changes into feature branch. bzr: revno 69.2.3, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sat 2008-08-23 13:40:15 -0400 |
||
#7 | 7003 | Matt McClure |
Snapshot. bzr: revno 69.2.1, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sun 2008-08-10 10:47:26 -0400 |
||
#6 | 6971 | Matt McClure |
Begins to add a test that renames a to b and adds a new b in a single commit. The bzr2p4.py tool currently fails on such a case. bzr: revno 69.1.1, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sun 2008-08-10 12:17:37 -0400 |
||
#5 | 6957 | Matt McClure |
I can run the tests like this: mlm@youk ~/.bazaar/plugins/bzrp4/tests $ bzr selftest bzrp4 bzr: revno 57.1.1, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sun 2008-08-03 08:11:02 -0400 |
||
#4 | 6940 | Matt McClure |
Refactors: adds a parameters and renames assertDirectoriesEqualModIgnored(). The test_git_p4.py tests pass on Windows and Cygwin. The test_dogfood.py tests pass on Windows, but not on Cygwin yet. bzr: revno 41, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sat 2008-07-19 07:55:59 -0400 |
||
#3 | 6939 | Matt McClure |
Cleans up git-p4 tests a bit. Makes the test fail on unexpected warnings. bzr: revno 40, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Thu 2008-07-17 22:38:20 -0400 |
||
#2 | 6937 | Matt McClure |
Passes test_git_p4.py test with Cygwin P4Python. Needs major clean up. I wouldn't be surprised if I broke the test on native Windows. I should probably change the 'dir /S' to 'ls -R' to make sure the test is verifying what I think it is. I used a native Windows p4 command line client for my test. bzr: revno 38, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sun 2008-07-13 20:07:59 -0400 |
||
#1 | 6936 | Matt McClure |
Extracts a base class from some of the copied common code in test_dogfood.py and test_git_p4.py. bzr: revno 37, part 1 of 1 bzr: author Matt McClure <mlm@aya.yale.edu> bzr: committed Sun 2008-07-13 14:33:20 -0400 |