mirror of
https://github.com/facebook/sapling.git
synced 2025-01-07 14:10:42 +03:00
hgsubversion: migrate all the tests to silentrunner
Summary: This migration allows `./run-tests.py` to run `hgsubversion` tests. Since hgsubversion tests are actually python unittests, we don't care about their output at all, they fail differently. But the behavior of the test suite require us to match whatever the tests prints. We do this later in the stack. Depends on D6719886 Test Plan: - check that tests are runnable at least Reviewers: #sourcecontrol Differential Revision: https://phabricator.intern.facebook.com/D6719890
This commit is contained in:
parent
82ca3e620b
commit
5a73bf5843
@ -60,3 +60,8 @@ for case in test_hgsubversion_util.custom:
|
||||
attrs[name] = buildmethod(case, name, stupid=True)
|
||||
|
||||
CustomPullTests = type('CustomPullTests', (test_hgsubversion_util.TestBase,), attrs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -40,3 +40,8 @@ def buildtestclass(cls):
|
||||
|
||||
|
||||
buildtestclass(test_push_command.PushTests)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -195,3 +195,8 @@ for case in [f for f in os.listdir(test_hgsubversion_util.FIXTURES) if f.endswit
|
||||
'single')
|
||||
|
||||
RebuildMetaTests = type('RebuildMetaTests', (test_hgsubversion_util.TestBase,), attrs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -76,3 +76,8 @@ buildtestclass(test_hgsubversion_utility_commands.UtilityTests)
|
||||
|
||||
buildtestclass(test_rebuildmeta.RebuildMetaTests, svndumpselector)
|
||||
buildtestclass(test_updatemeta.UpdateMetaTests, svndumpselector)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -65,3 +65,8 @@ if svnwrap.subversion_version < (1, 9, 0):
|
||||
attrs[name + '_custom'] = buildmethod(case, name + '_custom', 'custom')
|
||||
|
||||
StupidPullTests = type('StupidPullTests', (test_hgsubversion_util.TestBase,), attrs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -91,3 +91,8 @@ for case in [f for f in os.listdir(test_hgsubversion_util.FIXTURES) if f.endswit
|
||||
|
||||
|
||||
UpdateMetaTests = type('UpdateMetaTests', (test_hgsubversion_util.TestBase,), attrs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -106,3 +106,8 @@ for case in fixtures:
|
||||
attrs[bname + '_custom'] = buildmethod(case, bname + '_custom', 'custom')
|
||||
|
||||
VerifyTests = type('VerifyTests', (test_hgsubversion_util.TestBase,), attrs)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -6,3 +6,8 @@ class TestFetchBinaryFiles(test_hgsubversion_util.TestBase):
|
||||
def test_binaryfiles(self):
|
||||
repo = self._load_fixture_and_fetch('binaryfiles.svndump')
|
||||
self.assertEqual('cce7fe400d8d', str(repo['tip']))
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -31,3 +31,8 @@ class DiffTests(test_hgsubversion_util.TestBase):
|
||||
u.pushbuffer()
|
||||
wrappers.diff(lambda x, y, z: None, u, self.repo, svn=True)
|
||||
self.assertEqual(u.popbuffer(), expected_diff_output)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -395,3 +395,8 @@ HEAD subdir1/deps/project1
|
||||
self.commitchanges(changes)
|
||||
self.pushrevisions()
|
||||
self.assertchanges(changes, self.repo['tip'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -205,3 +205,8 @@ def suite():
|
||||
all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches),
|
||||
]
|
||||
return unittest.TestSuite(all_tests)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -143,3 +143,8 @@ Added: svn:executable
|
||||
changed = stupid.parsediff(data)
|
||||
self.assertEqual(['empty1', 'empty2', 'binary1', 'text1', 'binary2', 'text2'],
|
||||
[f.name for f in changed])
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -256,3 +256,8 @@ o changeset: 0:02996a5980ba (r3)
|
||||
"""
|
||||
self.assertMultiLineEqual(refgraph, graph)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -12,3 +12,8 @@ class TestFetchDirectoryRemoval(test_hgsubversion_util.TestBase):
|
||||
extra = repo['tip'].extra().copy()
|
||||
extra.pop('convert_revision', None)
|
||||
self.assertEqual(extra, {'branch': 'default'})
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -23,3 +23,8 @@ class TestFetchExec(test_hgsubversion_util.TestBase):
|
||||
self.assertEqual(node.hex(repo['tip'].node()),
|
||||
'08e6b380bf291b361a418203a1cb9427213cd1fd')
|
||||
self.assertEqual(repo['tip']['foo'].flags(), 'x')
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -375,3 +375,8 @@ class MapTests(test_hgsubversion_util.TestBase):
|
||||
commands.clone(ui, test_hgsubversion_util.fileurl(repo_path), self.wc_path)
|
||||
|
||||
self.assertEqual(self.repo['tip'].description(), 'blyf')
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
6
tests/test-hgsubversion-fetch-mappings.py.out
Normal file
6
tests/test-hgsubversion-fetch-mappings.py.out
Normal file
@ -0,0 +1,6 @@
|
||||
verifying c4dcdb393137 against file:///[\w/]*/testrepo-1/trunk@2 (re)
|
||||
verifying d4c6ea579d09 against file:///[\w/]*/testrepo-1/branches/badname@3 (re)
|
||||
verifying 34bdb5088d6e against file:///[\w/]*/testrepo-1/branches/feature@4 (re)
|
||||
verifying c4dcdb393137 against file:///[\w/]*/testrepo-1/trunk@2 (re)
|
||||
verifying d4c6ea579d09 against file:///[\w/]*/testrepo-1/branches/badname@3 (re)
|
||||
verifying 34bdb5088d6e against file:///[\w/]*/testrepo-1/branches/feature@4 (re)
|
@ -98,3 +98,8 @@ class TestFetchRenames(test_hgsubversion_util.TestBase):
|
||||
}
|
||||
for rev in repo:
|
||||
self.assertEqual(sorted(files[rev]), sorted(repo[rev].manifest()))
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -58,3 +58,8 @@ class TestMergeSpecial(test_hgsubversion_util.TestBase):
|
||||
ctx = repo['tip']
|
||||
self.assertEqual(ctx['fnord'].flags(), 'l')
|
||||
self.assertEqual(ctx['exe'].flags(), 'x')
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -26,3 +26,8 @@ class TestFetchTruncatedHistory(test_hgsubversion_util.TestBase):
|
||||
files.sort()
|
||||
self.assertEqual(files, ['a', 'b'])
|
||||
self.assertEqual(repo['tip']['a'].data(), 'a\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -31,3 +31,8 @@ class TestHelpers(unittest.TestCase):
|
||||
self.assertEqual([], os.listdir(fs._tempdir))
|
||||
self.assertRaises(editor.EditingError, lambda: fs.getfile('bb'))
|
||||
fs.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -40,3 +40,8 @@ class TestHooks(test_hgsubversion_util.TestBase):
|
||||
commands.pull(newrepo.ui, newrepo)
|
||||
svncommands.updatemeta = oldupdatemeta
|
||||
self.assertTrue(self.called)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -98,3 +98,8 @@ def _monkey_unpatch(to_patch, start=None):
|
||||
|
||||
def _patchbackend_raise(*p, **kw):
|
||||
raise mercurial.patch.PatchError("patch failed")
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -83,3 +83,8 @@ class TestPull(test_hgsubversion_util.TestBase):
|
||||
tip = repo['tip'].rev()
|
||||
self.assertEqual(tip, 1)
|
||||
self.assertEquals(verify.verify(repo.ui, repo, rev=tip), 0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
4
tests/test-hgsubversion-pull.py.out
Normal file
4
tests/test-hgsubversion-pull.py.out
Normal file
@ -0,0 +1,4 @@
|
||||
verifying [a-f0-9]{12} against file:///[\w/]*/testrepo-1/trunk@5 (re)
|
||||
difference in: alpha
|
||||
missing file: beta
|
||||
verifying [a-f0-9]{12} against file:///[\w/]*/testrepo-1/trunk@5 (re)
|
@ -99,3 +99,8 @@ class ParseAutoPropsTests(test_hgsubversion_util.TestBase):
|
||||
'svn:eol-style': 'native',
|
||||
'svn:executable': 'true'},
|
||||
props)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -823,3 +823,8 @@ class PushTests(test_hgsubversion_util.TestBase):
|
||||
self.assertNotEqual(newctx.node(), self.repo['tip'].node())
|
||||
self.assertEqual(newctx['adding_file'].data(), 'foo')
|
||||
self.assertEqual(newctx.branch(), 'the_branch')
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
2
tests/test-hgsubversion-push-command.py.out
Normal file
2
tests/test-hgsubversion-push-command.py.out
Normal file
@ -0,0 +1,2 @@
|
||||
Could not push revision 5cdb2c4d3ea4 because it had no changes in svn.
|
||||
Could not push revision 5cdb2c4d3ea4 because it had no changes in svn.
|
@ -105,3 +105,8 @@ class TestPushDirectories(test_hgsubversion_util.TestBase):
|
||||
'tag_r3/alpha',
|
||||
'tag_r3/beta',
|
||||
'tag_r3/new'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -28,3 +28,8 @@ class TestPushEol(test_hgsubversion_util.TestBase):
|
||||
self.commitchanges(changes)
|
||||
self.pushrevisions()
|
||||
self.assertchanges(changes, self.repo['tip'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -112,3 +112,8 @@ class TestPushRenames(test_hgsubversion_util.TestBase):
|
||||
'This failure means rename of an entire tree is broken.'
|
||||
' There is a print on the preceding line commented out '
|
||||
'that should help you.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -68,3 +68,8 @@ class TestRevMapMigrate(test_hgsubversion_util.TestBase):
|
||||
|
||||
def test_revmap_migrate_down(self):
|
||||
self._test_revmap_migrate(maps.SqliteRevMap, maps.RevMap)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -79,3 +79,8 @@ class TestSingleDirClone(test_hgsubversion_util.TestBase):
|
||||
expect = '' # Not honestly sure what this should be...
|
||||
test = 4
|
||||
self.assertEqual(self.repo[test]['.hgsvnexternals'].data(), expect)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -208,3 +208,8 @@ class TestSingleDirPush(test_hgsubversion_util.TestBase):
|
||||
|
||||
self.assertEquals(set(['flaf']),
|
||||
set(self.repo[i].branch() for i in self.repo))
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -27,3 +27,8 @@ class TestSvnPreCommitHooks(test_hgsubversion_util.TestBase):
|
||||
]
|
||||
self.commitchanges(changes)
|
||||
self.assertRaises(util.Abort, self.pushrevisions)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -51,3 +51,8 @@ class TestRootAsSubdirOfRepo(TestBasicRepoLayout):
|
||||
self.repo = svnwrap.SubversionRepo(test_hgsubversion_util.fileurl(
|
||||
self.repo_path + '/dummyproj'
|
||||
))
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -237,3 +237,8 @@ Fix tag pt 2.
|
||||
test-0.1: hg=test@1:svn=branches/test@3
|
||||
"""
|
||||
self._test_tags('renametagdir.svndump', expected)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -83,3 +83,8 @@ o
|
||||
self.assertRaises(error.ParseError,
|
||||
commands.log, self.ui(), repo,
|
||||
template='{rev}:{svnrev} ', **defaults)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
10
tests/test-hgsubversion-template-keywords.py.out
Normal file
10
tests/test-hgsubversion-template-keywords.py.out
Normal file
@ -0,0 +1,10 @@
|
||||
rev: 2 svnrev: svnpath: svnuuid:
|
||||
@
|
||||
|
|
||||
rev: 1 svnrev:3 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
|
||||
o
|
||||
|
|
||||
rev: 0 svnrev:2 svnpath:/trunk svnuuid:df2126f7-00ab-4d49-b42c-7e981dde0bcf
|
||||
o
|
||||
|
||||
|
@ -88,3 +88,8 @@ class TestMercurialCore(test_hgsubversion_util.TestBase):
|
||||
repo2 = hg.repository(ui, self.wc_path + '2')
|
||||
|
||||
self.assertEqual(repo[branch].hex(), repo2['.'].hex())
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -83,3 +83,8 @@ class TestSubversionUrls(test_hgsubversion_util.TestBase):
|
||||
repo = svnrepo.svnremoterepo(self.ui(), path=args[0])
|
||||
self.assertEqual(expected[2], repo.svnauth[0])
|
||||
self.assertEqual(expected[2], repo.svnurl)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
@ -375,3 +375,8 @@ missing file: binary3
|
||||
# rebuildmeta --unsafe-skip-uuid-check with unrelated repo
|
||||
svncommands.rebuildmeta(self.ui(), repo=self.repo, args=[otherurl],
|
||||
unsafe_skip_uuid_check=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
import silenttestrunner
|
||||
silenttestrunner.main(__name__)
|
||||
|
||||
|
4
tests/test-hgsubversion-utility-commands.py.out
Normal file
4
tests/test-hgsubversion-utility-commands.py.out
Normal file
@ -0,0 +1,4 @@
|
||||
verifying 78e965230a13 against file:///[\w/]*/testrepo-1@1 (re)
|
||||
verifying 78e965230a13 against file:///[\w/]*/testrepo-1@1 (re)
|
||||
verifying d51f46a715a1 against file:///[\w/]*/testrepo-1/trunk@3 (re)
|
||||
verifying d51f46a715a1 against file:///[\w/]*/testrepo-1/trunk@3 (re)
|
Loading…
Reference in New Issue
Block a user