Mercurial > hg
annotate tests/test-dirs.py @ 48850:656196c1d442
setup: drop support for Python 3.5
We talked about this on the mailing list [1] and there seemed to be
agreement that Python 3.5 is effectively dead and no longer worth
supporting.
So this commit changes our minimum version requirement to 3.6.2.
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2022-February/147885.html
Differential Revision: https://phab.mercurial-scm.org/D12315
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 02 Mar 2022 18:42:00 -0800 |
parents | 627cd8f33db0 |
children | 6000f5b25c9b |
rev | line source |
---|---|
43494
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
1 from __future__ import absolute_import |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
2 |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
3 import unittest |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
4 |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
5 import silenttestrunner |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
6 |
43523
c21aca51b392
utils: move the `dirs` definition in pathutil (API)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43494
diff
changeset
|
7 from mercurial import pathutil |
43494
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
8 |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
9 |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
10 class dirstests(unittest.TestCase): |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
11 def testdirs(self): |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
12 for case, want in [ |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
13 (b'a/a/a', [b'a', b'a/a', b'']), |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 (b'alpha/beta/gamma', [b'', b'alpha', b'alpha/beta']), |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
15 ]: |
48021
627cd8f33db0
rust: Remove support for passing a dict to the Rust pathutil.dirs()
Simon Sapin <simon.sapin@octobus.net>
parents:
43523
diff
changeset
|
16 d = pathutil.dirs([]) |
43494
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 d.addpath(case) |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 self.assertEqual(sorted(d), sorted(want)) |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
19 |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
20 def testinvalid(self): |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 with self.assertRaises(ValueError): |
48021
627cd8f33db0
rust: Remove support for passing a dict to the Rust pathutil.dirs()
Simon Sapin <simon.sapin@octobus.net>
parents:
43523
diff
changeset
|
22 d = pathutil.dirs([]) |
43494
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 d.addpath(b'a//b') |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
24 |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
25 |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
26 if __name__ == '__main__': |
5d40317d42b7
dirs: reject consecutive slashes in paths
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
27 silenttestrunner.main(__name__) |