File tree Expand file tree Collapse file tree 8 files changed +74
-2
lines changed Expand file tree Collapse file tree 8 files changed +74
-2
lines changed Original file line number Diff line number Diff line change
1
+ sudo : false
1
2
language : python
2
3
# command to install dependencies
3
- install : " pip install -U detox "
4
+ install : " pip install -U tox "
4
5
# # command to run tests
5
- script : detox --recreate -i ALL=https://devpi.net/hpk/dev/
6
+ env :
7
+ matrix :
8
+ - TESTENV=flakes
9
+ - TESTENV=py26
10
+ - TESTENV=py27
11
+ - TESTENV=py34
12
+ - TESTENV=pypy
13
+ - TESTENV=py27-pexpect
14
+ - TESTENV=py33-pexpect
15
+ - TESTENV=py27-nobyte
16
+ - TESTENV=py33
17
+ - TESTENV=py27-xdist
18
+ - TESTENV=py33-xdist
19
+ - TESTENV=py27
20
+ - TESTENV=py27-trial
21
+ - TESTENV=py33
22
+ - TESTENV=py33-trial
23
+ # inprocess tests by default were introduced in 2.8 only;
24
+ # this TESTENV should be enabled when merged back to master
25
+ # - TESTENV=py27-subprocess
26
+ - TESTENV=doctesting
27
+ - TESTENV=py27-cxfreeze
28
+ - TESTENV=coveralls
29
+ script : tox --recreate -i ALL=https://devpi.net/hpk/dev/ -e $TESTENV
6
30
7
31
notifications :
8
32
irc :
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Andreas Zeidler
8
8
Andy Freeland
9
9
Anthon van der Neut
10
10
Armin Rigo
11
+ Aron Curzon
11
12
Benjamin Peterson
12
13
Bob Ippolito
13
14
Brian Dorsey
Original file line number Diff line number Diff line change 1
1
2.7.2 (compared to 2.7.1)
2
2
-----------------------------
3
3
4
+ - Automatically create directory for junitxml and results log.
5
+ Thanks Aron Curzon.
6
+
4
7
- fix issue713: JUnit XML reports for doctest failures.
5
8
Thanks Punyashloka Biswal.
6
9
Original file line number Diff line number Diff line change @@ -205,6 +205,9 @@ def pytest_sessionstart(self):
205
205
self .suite_start_time = time .time ()
206
206
207
207
def pytest_sessionfinish (self ):
208
+ dirname = os .path .dirname (os .path .abspath (self .logfile ))
209
+ if not os .path .isdir (dirname ):
210
+ os .makedirs (dirname )
208
211
logfile = open (self .logfile , 'w' , encoding = 'utf-8' )
209
212
suite_stop_time = time .time ()
210
213
suite_time_delta = suite_stop_time - self .suite_start_time
Original file line number Diff line number Diff line change 3
3
"""
4
4
5
5
import py
6
+ import os
6
7
7
8
def pytest_addoption (parser ):
8
9
group = parser .getgroup ("terminal reporting" , "resultlog plugin options" )
@@ -14,6 +15,9 @@ def pytest_configure(config):
14
15
resultlog = config .option .resultlog
15
16
# prevent opening resultlog on slave nodes (xdist)
16
17
if resultlog and not hasattr (config , 'slaveinput' ):
18
+ dirname = os .path .dirname (os .path .abspath (resultlog ))
19
+ if not os .path .isdir (dirname ):
20
+ os .makedirs (dirname )
17
21
logfile = open (resultlog , 'w' , 1 ) # line buffered
18
22
config ._resultlog = ResultLog (config , logfile )
19
23
config .pluginmanager .register (config ._resultlog )
Original file line number Diff line number Diff line change @@ -474,6 +474,16 @@ def test_func():
474
474
assert result .ret == 0
475
475
assert testdir .tmpdir .join ("a/x.xml" ).check ()
476
476
477
+ def test_logxml_makedir (testdir ):
478
+ """--junitxml should automatically create directories for the xml file"""
479
+ testdir .makepyfile ("""
480
+ def test_pass():
481
+ pass
482
+ """ )
483
+ result = testdir .runpytest ("--junitxml=path/to/results.xml" )
484
+ assert result .ret == 0
485
+ assert testdir .tmpdir .join ("path/to/results.xml" ).check ()
486
+
477
487
def test_escaped_parametrized_names_xml (testdir ):
478
488
testdir .makepyfile ("""
479
489
import pytest
Original file line number Diff line number Diff line change @@ -180,6 +180,21 @@ def test_xfail_norun():
180
180
"x *:test_xfail_norun" ,
181
181
])
182
182
183
+ def test_makedir_for_resultlog (testdir , LineMatcher ):
184
+ """--resultlog should automatically create directories for the log file"""
185
+ testdir .plugins .append ("resultlog" )
186
+ testdir .makepyfile ("""
187
+ import pytest
188
+ def test_pass():
189
+ pass
190
+ """ )
191
+ testdir .runpytest ("--resultlog=path/to/result.log" )
192
+ lines = testdir .tmpdir .join ("path/to/result.log" ).readlines (cr = 0 )
193
+ LineMatcher (lines ).fnmatch_lines ([
194
+ ". *:test_pass" ,
195
+ ])
196
+
197
+
183
198
def test_no_resultlog_on_slaves (testdir ):
184
199
config = testdir .parseconfig ("-p" , "resultlog" , "--resultlog=resultlog" )
185
200
Original file line number Diff line number Diff line change @@ -132,6 +132,18 @@ commands=
132
132
{envpython} runtests_setup.py build --build-exe build
133
133
{envpython} tox_run.py
134
134
135
+ [testenv:coveralls]
136
+ changedir =testing
137
+ basepython =python3.4
138
+ deps =
139
+ {[testenv]deps}
140
+ coveralls
141
+ commands =
142
+ coverage run --source =_pytest {envdir}/bin/py.test
143
+ coverage report -m
144
+ coveralls
145
+ passenv =COVERALLS_REPO_TOKEN
146
+
135
147
[pytest]
136
148
minversion =2.0
137
149
plugins =pytester
You can’t perform that action at this time.
0 commit comments