use os.path.expanduser/expandvars on the junitxml path for convience, fixes #44
This commit is contained in:
parent
95ddd5059f
commit
56b40ebd75
|
@ -65,7 +65,7 @@ def pytest_unconfigure(config):
|
||||||
|
|
||||||
class LogXML(object):
|
class LogXML(object):
|
||||||
def __init__(self, logfile, prefix):
|
def __init__(self, logfile, prefix):
|
||||||
self.logfile = logfile
|
self.logfile = os.path.expanduser(os.path.expandvars(logfile))
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
self.test_logs = []
|
self.test_logs = []
|
||||||
self.passed = self.skipped = 0
|
self.passed = self.skipped = 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
import py, sys
|
import py, sys, os
|
||||||
|
|
||||||
def runandparse(testdir, *args):
|
def runandparse(testdir, *args):
|
||||||
resultpath = testdir.tmpdir.join("junit.xml")
|
resultpath = testdir.tmpdir.join("junit.xml")
|
||||||
|
@ -351,3 +351,16 @@ def test_invalid_xml_escape(testdir):
|
||||||
assert '#x%04X' % i in text
|
assert '#x%04X' % i in text
|
||||||
for i in valid:
|
for i in valid:
|
||||||
assert chr(i) in text
|
assert chr(i) in text
|
||||||
|
|
||||||
|
def test_logxml_path_expansion():
|
||||||
|
from _pytest.junitxml import LogXML
|
||||||
|
|
||||||
|
home_tilde = py.path.local(os.path.expanduser('~/test.xml'))
|
||||||
|
# this is here for when $HOME is not set correct
|
||||||
|
home_var = py.path.local(os.path.expandvars('$HOME/test.xml'))
|
||||||
|
|
||||||
|
xml_tilde = LogXML('~/test.xml', None)
|
||||||
|
assert xml_tilde.logfile == home_tilde
|
||||||
|
|
||||||
|
xml_var = LogXML('$HOME/test.xml', None)
|
||||||
|
assert xml_var.logfile == home_var
|
||||||
|
|
Loading…
Reference in New Issue