diff --git a/CHANGELOG b/CHANGELOG index 562c95789..7ab010f0e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ Changes between 2.2.4 and 2.3.0.dev ----------------------------------- +- fix junitxml=path construction so that if tests change the + current working directory and the path is a relative path + it is constructed correctly from the original current working dir. - fix "python setup.py test" example to cause a proper "errno" return - fix issue165 - fix broken doc links and mention stackoverflow for FAQ - fix issue139 - merge FuncargRequest and Item API such that diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 8e0072c6d..996169286 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.3.0.dev8' +__version__ = '2.3.0.dev9' diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index 6eb1d973c..acf347bd9 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -89,7 +89,7 @@ def mangle_testnames(names): class LogXML(object): def __init__(self, logfile, prefix): logfile = os.path.expanduser(os.path.expandvars(logfile)) - self.logfile = os.path.normpath(logfile) + self.logfile = os.path.normpath(os.path.abspath(logfile)) self.prefix = prefix self.tests = [] self.passed = self.skipped = 0 diff --git a/doc/en/setup.txt b/doc/en/setup.txt index d86c24f93..418b91ac8 100644 --- a/doc/en/setup.txt +++ b/doc/en/setup.txt @@ -31,7 +31,7 @@ you can do with the old-style and much more. Specifically setup functions: - can receive :ref:`resources through funcargs `, - fully interoperate with parametrized resources, -- can be defined in a plugin or :ref:`conftest.py` file and get called +- can be defined in a plugin or :ref:`conftest.py ` file and get called on a per-session, per-module, per-class or per-function basis, - can access the :ref:`testcontext ` for which the setup is called, - can precisely control teardown by registering one or multiple diff --git a/setup.py b/setup.py index 7672143ac..d9c0685fa 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def main(): name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.3.0.dev8', + version='2.3.0.dev9', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 27351f1dc..1f99b85d8 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -392,3 +392,15 @@ def test_logxml_path_expansion(): xml_var = LogXML('$HOME/test.xml', None) assert xml_var.logfile == home_var + +def test_logxml_changingdir(testdir): + testdir.makepyfile(""" + def test_func(): + import os + os.chdir("a") + """) + testdir.tmpdir.mkdir("a") + result = testdir.runpytest("--junitxml=a/x.xml") + assert result.ret == 0 + assert testdir.tmpdir.join("a/x.xml").check() +