Mercurial > hg
annotate tests/test-hg-parseurl.py @ 47405:88119fffecc8
rhg: look for repository in ancestors also instead of cwd only
Last patch introduced config reading at startup to parse value of `--repository`
flag. However, that patch only tried to check for current repository at current
working directory and not it's ancestors. This patch fixes that.
Differential Revision: https://phab.mercurial-scm.org/D10767
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 24 May 2021 16:27:54 +0530 |
parents | 4452cb788404 |
children | 6000f5b25c9b |
rev | line source |
---|---|
28746
de5808c57f58
py3: use print_function in test-hg-parseurl.py
Robert Stanca <robert.stanca7@gmail.com>
parents:
28745
diff
changeset
|
1 from __future__ import absolute_import, print_function |
28806
d26c4af27978
test-hg-parseurl: stop direct symbol import of mercurial.hg.parseurl
Yuya Nishihara <yuya@tcha.org>
parents:
28746
diff
changeset
|
2 |
37713
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
3 import unittest |
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
4 |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
5 from mercurial.utils import urlutil |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
6 |
8174
29bc5d18714a
hg: allow hg.parseurl(url, None)
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
7 |
37713
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
8 class ParseRequestTests(unittest.TestCase): |
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
9 def testparse(self): |
8174
29bc5d18714a
hg: allow hg.parseurl(url, None)
Martijn Pieters <mj@zopatista.com>
parents:
diff
changeset
|
10 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
11 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
12 urlutil.parseurl(b'http://example.com/no/anchor'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
13 (b'http://example.com/no/anchor', (None, [])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
14 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
15 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
16 urlutil.parseurl(b'http://example.com/an/anchor#foo'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
17 (b'http://example.com/an/anchor', (b'foo', [])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
18 ) |
37713
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
19 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
20 urlutil.parseurl( |
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
21 b'http://example.com/no/anchor/branches', [b'foo'] |
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
22 ), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
23 (b'http://example.com/no/anchor/branches', (None, [b'foo'])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
24 ) |
37713
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
25 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
26 urlutil.parseurl( |
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
27 b'http://example.com/an/anchor/branches#bar', [b'foo'] |
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
28 ), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
29 (b'http://example.com/an/anchor/branches', (b'bar', [b'foo'])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
30 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
31 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
32 urlutil.parseurl( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
33 b'http://example.com/an/anchor/branches-None#foo', None |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
34 ), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
35 (b'http://example.com/an/anchor/branches-None', (b'foo', [])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
36 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
37 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
38 urlutil.parseurl(b'http://example.com/'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
39 (b'http://example.com/', (None, [])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
40 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
41 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
42 urlutil.parseurl(b'http://example.com'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
43 (b'http://example.com/', (None, [])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
44 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
45 self.assertEqual( |
46908
4452cb788404
urlutil: extract `parseurl` from `hg` into the new module
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43076
diff
changeset
|
46 urlutil.parseurl(b'http://example.com#foo'), |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
47 (b'http://example.com/', (b'foo', [])), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
48 ) |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
49 |
37713
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
50 |
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
51 if __name__ == '__main__': |
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
52 import silenttestrunner |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
37714
diff
changeset
|
53 |
37713
11d128a14ec0
tests: port test-hg-parseurl.py to unittest
Augie Fackler <augie@google.com>
parents:
28806
diff
changeset
|
54 silenttestrunner.main(__name__) |