aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Yan <felixonmars@archlinux.org>2017-03-16 16:48:21 +0800
committerGitHub <noreply@github.com>2017-03-16 16:48:21 +0800
commitb3525570929ba47c10d9d08696876c39487f7000 (patch)
treeeff11fdbe3d6f10e008dd28c753a392d8fd9c30f
parentb275257553d46af3f30ddb79d9963ebdc19f065e (diff)
downloadmitmproxy-b3525570929ba47c10d9d08696876c39487f7000.tar.gz
mitmproxy-b3525570929ba47c10d9d08696876c39487f7000.tar.bz2
mitmproxy-b3525570929ba47c10d9d08696876c39487f7000.zip
Fix test_format_xml with dot in path
When the path contains dot ".", replacing all dots will generate a non-exist result and raises a FileNotFoundError. Replacing only the last dot fixes this.
-rw-r--r--test/mitmproxy/contentviews/test_xml_html.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/mitmproxy/contentviews/test_xml_html.py b/test/mitmproxy/contentviews/test_xml_html.py
index 899ecfde..2b0aee4d 100644
--- a/test/mitmproxy/contentviews/test_xml_html.py
+++ b/test/mitmproxy/contentviews/test_xml_html.py
@@ -23,7 +23,7 @@ def test_format_xml(filename):
path = data.path(filename)
with open(path) as f:
input = f.read()
- with open(path.replace(".", "-formatted.")) as f:
+ with open("-formatted.".join(path.rsplit(".", 1))) as f:
expected = f.read()
tokens = xml_html.tokenize(input)
assert xml_html.format_xml(tokens) == expected