fix/consolidate --junitxml=path construction with relative pathes

This commit is contained in:
holger krekel 2012-08-04 10:33:43 +02:00
parent 6746a00cb8
commit 172505f703
6 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -1,2 +1,2 @@
#
__version__ = '2.3.0.dev8'
__version__ = '2.3.0.dev9'

View File

@ -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

View File

@ -31,7 +31,7 @@ you can do with the old-style and much more. Specifically setup functions:
- can receive :ref:`resources through funcargs <resources>`,
- 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 <conftest.py>` file and get called
on a per-session, per-module, per-class or per-function basis,
- can access the :ref:`testcontext <testcontext>` for which the setup is called,
- can precisely control teardown by registering one or multiple

View File

@ -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'],

View File

@ -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()