1. Brianna Laugher
  2. pytest

Commits

holger krekel  committed 8573473

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

  • Participants
  • Parent commits 49dfa38
  • Branches default

Comments (0)

Files changed (6)

File CHANGELOG

View file
  • Ignore whitespace
 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 

File _pytest/__init__.py

View file
  • Ignore whitespace
 #
-__version__ = '2.3.0.dev8'
+__version__ = '2.3.0.dev9'

File _pytest/junitxml.py

View file
  • Ignore whitespace
 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

File doc/en/setup.txt

View file
  • Ignore whitespace
 
 - 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 

File setup.py

View file
  • Ignore whitespace
         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'],

File testing/test_junitxml.py

View file
  • Ignore whitespace
 
     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()
+