Mercurial > hg
comparison tests/test-hgweb-no-path-info.t @ 40203:f80f7a67e176
tests: fix style issue of importing hgweb in embedded code fragments
Some test scripts are excluded in test-check-module-imports.t, because
import-checker.py reports that hgweb and/or hgwebdir of
mercurial.hgweb are not imported in recommended style.
To fix this issues, this patch make python code fragments embedded in
these files import hgweb from mercurial package at first, and refer
hgweb and hgwebdir via imported hgweb.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 08 Oct 2018 10:10:06 +0900 |
parents | 3eea8e83c261 |
children | 42d2b31cee0b |
comparison
equal
deleted
inserted
replaced
40202:56ea22fa55f0 | 40203:f80f7a67e176 |
---|---|
16 | 16 |
17 $ cat > request.py <<EOF | 17 $ cat > request.py <<EOF |
18 > from __future__ import absolute_import | 18 > from __future__ import absolute_import |
19 > import os | 19 > import os |
20 > import sys | 20 > import sys |
21 > from mercurial.hgweb import ( | 21 > from mercurial import ( |
22 > hgweb, | 22 > hgweb, |
23 > hgwebdir, | |
24 > ) | |
25 > from mercurial import ( | |
26 > util, | 23 > util, |
27 > ) | 24 > ) |
28 > stringio = util.stringio | 25 > stringio = util.stringio |
29 > | 26 > |
30 > errors = stringio() | 27 > errors = stringio() |
70 > print(errors.getvalue()) | 67 > print(errors.getvalue()) |
71 > sys.stdout.flush() | 68 > sys.stdout.flush() |
72 > | 69 > |
73 > output = stringio() | 70 > output = stringio() |
74 > env['QUERY_STRING'] = 'style=atom' | 71 > env['QUERY_STRING'] = 'style=atom' |
75 > process(hgweb(b'.', name=b'repo')) | 72 > process(hgweb.hgweb(b'.', name=b'repo')) |
76 > | 73 > |
77 > output = stringio() | 74 > output = stringio() |
78 > env['QUERY_STRING'] = 'style=raw' | 75 > env['QUERY_STRING'] = 'style=raw' |
79 > process(hgwebdir({b'repo': b'.'})) | 76 > process(hgweb.hgwebdir({b'repo': b'.'})) |
80 > EOF | 77 > EOF |
81 $ "$PYTHON" request.py | 78 $ "$PYTHON" request.py |
82 ---- STATUS | 79 ---- STATUS |
83 200 Script output follows | 80 200 Script output follows |
84 ---- HEADERS | 81 ---- HEADERS |