Mercurial > hgsubversion
annotate tests/comprehensive/test_stupid_pull.py @ 1501:6e3f48d8002f
tests: fix ipv6 support in test_push_command.py
This test runs the `svnserve` binary, which appears to resolve the hostname
passed as an argument using gethostbyname(3), which can only return an IPv4
address. When run on a system that is configured to only have an IPv6 address,
Mercurial will correctly resolve the hostname to an IPv6 address, but the SVN
server will be listening on an incorrect IPv4 address, causing the test to
fail. The workaround is to resolve the hostname using getaddrinfo(3) in the
test harness and pass the resulting address to svnserve.
author | Arun Kulshreshtha <kulshrax@fb.com> |
---|---|
date | Mon, 10 Apr 2017 16:58:28 -0700 |
parents | 89997a5fc181 |
children |
rev | line source |
---|---|
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 import os |
766
124cd25de4ef
tests: fix running the comprehensive tests using nose.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
613
diff
changeset
|
2 import sys |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 import unittest |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 from mercurial import hg |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 from mercurial import ui |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 |
613
58f397523604
testrunner: delay and `simplify' importing of tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
8 # wrapped in a try/except because of weirdness in how |
58f397523604
testrunner: delay and `simplify' importing of tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
9 # run.py works as compared to nose. |
58f397523604
testrunner: delay and `simplify' importing of tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
10 try: |
58f397523604
testrunner: delay and `simplify' importing of tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
11 import test_util |
58f397523604
testrunner: delay and `simplify' importing of tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
12 except ImportError: |
766
124cd25de4ef
tests: fix running the comprehensive tests using nose.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
613
diff
changeset
|
13 sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) |
124cd25de4ef
tests: fix running the comprehensive tests using nose.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
613
diff
changeset
|
14 import test_util |
613
58f397523604
testrunner: delay and `simplify' importing of tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
499
diff
changeset
|
15 |
354
36d26e158748
comprehensive: fix for new repo layout.
Augie Fackler <durin42@gmail.com>
parents:
347
diff
changeset
|
16 from hgsubversion import wrappers |
1365
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
17 from hgsubversion import svnwrap |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
20 def _do_case(self, name, layout): |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 subdir = test_util.subdir.get(name, '') |
1092
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
22 config = {} |
1342
c6b01fd34694
trying to fix progress output
Augie Fackler <raf@durin42.com>
parents:
1133
diff
changeset
|
23 u = test_util.testui() |
1092
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
24 for branch, path in test_util.custom.get(name, {}).iteritems(): |
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
25 config['hgsubversionbranch.%s' % branch] = path |
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
26 u.setconfig('hgsubversionbranch', branch, path) |
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
27 repo, repo_path = self.load_and_fetch(name, |
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
28 subdir=subdir, |
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
29 layout=layout, |
cd0d14e25757
layouts: add custom layout for those of us that need weird mappings
David Schleimer <dschleimer@fb.com>
parents:
1057
diff
changeset
|
30 config=config) |
1048
903c9c9dfe6a
tests: count revisions explicitly
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
31 assert test_util.repolen(self.repo) > 0, \ |
903c9c9dfe6a
tests: count revisions explicitly
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
32 'Repo had no changes, maybe you need to add a subdir entry in test_util?' |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 wc2_path = self.wc_path + '_stupid' |
867
50c13e01c7e3
test_util: add a load_and_fetch() returning the repo_path
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
34 checkout_path = repo_path |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
35 if subdir: |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
36 checkout_path += '/' + subdir |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
257
diff
changeset
|
37 u.setconfig('hgsubversion', 'stupid', '1') |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
38 u.setconfig('hgsubversion', 'layout', layout) |
816
86d124a8768e
Fix hg.clone() calls changed by d976542986d2
Patrick Mezard <pmezard@gmail.com>
parents:
766
diff
changeset
|
39 test_util.hgclone(u, test_util.fileurl(checkout_path), wc2_path, update=False) |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
40 if layout == 'single': |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
41 self.assertEqual(len(self.repo.heads()), 1) |
1342
c6b01fd34694
trying to fix progress output
Augie Fackler <raf@durin42.com>
parents:
1133
diff
changeset
|
42 self.repo2 = hg.repository(test_util.testui(), wc2_path) |
445
24a8471069c0
tests: test for heads equality instead of branchtags
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
383
diff
changeset
|
43 self.assertEqual(self.repo.heads(), self.repo2.heads()) |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
44 |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
45 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
46 def buildmethod(case, name, layout): |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
47 m = lambda self: self._do_case(case, layout) |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
48 m.__name__ = name |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
49 m.__doc__ = 'Test stupid produces same as real on %s. (%s)' % (case, layout) |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
50 return m |
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
51 |
1365
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
52 if svnwrap.subversion_version < (1, 9, 0): |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
53 attrs = {'_do_case': _do_case, |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
54 } |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
55 for case in (f for f in os.listdir(test_util.FIXTURES) |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
56 if f.endswith('.svndump')): |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
57 if case == 'corrupt.svndump': |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
58 continue |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
59 name = 'test_' + case[:-len('.svndump')].replace('-', '_') |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
60 # Automatic layout branchtag collision exposes a minor defect |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
61 # here, but since it isn't a regression we suppress the test case. |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
62 if case != 'branchtagcollision.svndump': |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
63 attrs[name] = buildmethod(case, name, 'auto') |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
64 attrs[name + '_single'] = buildmethod(case, name + '_single', 'single') |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
65 if case in test_util.custom: |
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
66 attrs[name + '_custom'] = buildmethod(case, name + '_custom', 'custom') |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
445
diff
changeset
|
67 |
1365
89997a5fc181
stupid: self-disable if svn bindings are too new to work with stupid mode
Augie Fackler <raf@durin42.com>
parents:
1342
diff
changeset
|
68 StupidPullTests = type('StupidPullTests', (test_util.TestBase,), attrs) |