Mercurial > hg
annotate tests/test-dirs.py @ 47826:83235fb50e1c stable
run-tests: introduce a --pyoxidized option
This options make it possible to use the pyoxidizer version to run the tests.
This is a first basic version that is windows only.
The test needs a working python, with Mercurial installed. However the
pyoxidizer product is "self contains" without a "usable" Python. There have been
discussion to have a fully functional `hg admin::python` command providing a
fully functional python interpreter, but nothing is of the sort is ready yet. In
In the meantime we use an hybrid approach, similar to what we do for testing
`rhg`. We install a full "normal" Mercurial, but also the pyxodizer product as
the official `hg binary`. That way, we use the pyoxidizer version or everything,
but test that needs to run python have it available, with a fully functional
Mercurial package.
This first version is pretty basic (Windows only, no --local, not
--with-pyoxidized), but it runs, various bug that we will have to fix.
Differential Revision: https://phab.mercurial-scm.org/D11277
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 10 Aug 2021 12:56:32 +0200 |
parents | c21aca51b392 |
children | 627cd8f33db0 |
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 ]: |
43523
c21aca51b392
utils: move the `dirs` definition in pathutil (API)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43494
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): |
43523
c21aca51b392
utils: move the `dirs` definition in pathutil (API)
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43494
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__) |