From 9346e18d8c2e611747fe2b7c82ab6f0ae38aec55 Mon Sep 17 00:00:00 2001 From: curzona Date: Tue, 16 Jun 2015 15:36:04 -0700 Subject: [PATCH] Test creating directory for junit-xml and resultlog --- testing/test_junitxml.py | 9 +++++++++ testing/test_resultlog.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 9da836bbe..65e3ca03f 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -474,6 +474,15 @@ def test_logxml_changingdir(testdir): assert result.ret == 0 assert testdir.tmpdir.join("a/x.xml").check() +def test_logxml_makedir(testdir): + testdir.makepyfile(""" + def test_pass(): + pass + """) + result = testdir.runpytest("--junitxml=path/to/results.xml") + assert result.ret == 0 + assert testdir.tmpdir.join("path/to/results.xml").check() + def test_escaped_parametrized_names_xml(testdir): testdir.makepyfile(""" import pytest diff --git a/testing/test_resultlog.py b/testing/test_resultlog.py index e4f3faccc..96686d3a2 100644 --- a/testing/test_resultlog.py +++ b/testing/test_resultlog.py @@ -180,6 +180,20 @@ def test_generic(testdir, LineMatcher): "x *:test_xfail_norun", ]) +def test_makedir_for_resultlog(testdir, LineMatcher): + testdir.plugins.append("resultlog") + testdir.makepyfile(""" + import pytest + def test_pass(): + pass + """) + testdir.runpytest("--resultlog=path/to/result.log") + lines = testdir.tmpdir.join("path/to/result.log").readlines(cr=0) + LineMatcher(lines).fnmatch_lines([ + ". *:test_pass", + ]) + + def test_no_resultlog_on_slaves(testdir): config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")