Mercurial > piecrust2
annotate tests/pathutil.py @ 1169:978ed6deea91
tests: Add ability to test different expected outputs based on Python version.
Similar to the previous change, there was also a change in what gets escaped
by `urllib.parse.quote` (as in: the tilde sign ('~') stopped being escaped).
So now we need to be able to test different outputs in the tests, yay again.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 04 Oct 2019 11:15:11 -0700 |
parents | a2d283d1033d |
children |
rev | line source |
---|---|
286
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 import os |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
3 |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
4 def slashfix(path): |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
5 if path is None: |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 return None |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 if isinstance(path, str): |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
8 return path.replace('/', os.sep) |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 fixed = [] |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 for p in path: |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 fixed.append(p.replace('/', os.sep)) |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 return fixed |
a2d283d1033d
tests: Fixes for running on Windows.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
13 |