Fix test for windows

This commit is contained in:
holger@merlinux.eu 2012-10-08 13:42:31 +02:00
parent 916c1c170e
commit 39b8a19cf7
1 changed files with 5 additions and 3 deletions

View File

@ -383,16 +383,18 @@ def test_invalid_xml_escape():
for i in valid: for i in valid:
assert chr(i) == bin_xml_escape(unichr(i)).uniobj assert chr(i) == bin_xml_escape(unichr(i)).uniobj
def test_logxml_path_expansion(): def test_logxml_path_expansion(tmpdir, monkeypatch):
from _pytest.junitxml import LogXML from _pytest.junitxml import LogXML
home_tilde = os.path.normpath(os.path.expanduser('~/test.xml')) home_tilde = os.path.normpath(os.path.expanduser('~/test.xml'))
# this is here for when $HOME is not set correct
home_var = os.path.normpath(os.path.expandvars('$HOME/test.xml'))
xml_tilde = LogXML('~/test.xml', None) xml_tilde = LogXML('~/test.xml', None)
assert xml_tilde.logfile == home_tilde assert xml_tilde.logfile == home_tilde
# this is here for when $HOME is not set correct
monkeypatch.setenv("HOME", tmpdir)
home_var = os.path.normpath(os.path.expandvars('$HOME/test.xml'))
xml_var = LogXML('$HOME/test.xml', None) xml_var = LogXML('$HOME/test.xml', None)
assert xml_var.logfile == home_var assert xml_var.logfile == home_var