Trying to run nosetests outputing with xunit and using suite

隐身守侯 提交于 2020-01-05 09:35:14

问题


I'm trying to run nosetests in web2py using suite and outputing with xunit, it creates the xml files but even if the console shows that there were errors, but, they are not been written in the xml file

The .py script:

suite = TestLoader().loadTestsFromTestClass(globals()[strArchivo+strDirectorio])
            noseargs = ['fake','--processes=0','v=0','--process-timeout=60',
                        '--with-xunit', '--xunit-file=applications/output.xml','--verbosity=0']

            nose.run(argv = noseargs,suite = suite)

The console output:

web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2015
Version 2.12.3-stable+timestamp.2015.08.19.00.18.03
Database drivers available: sqlite3, imaplib, pymysql, pg8000
INFO:urllib3.connectionpool:Starting new HTTP connection (1): servicio
DEBUG:urllib3.connectionpool:Setting read timeout to None
DEBUG:urllib3.connectionpool:"POST /servicios/hotel_servicio/call/json/inserHotel/ HTTP/1.1" 200 None
INFO:urllib3.connectionpool:Starting new HTTP connection (1): servicio
DEBUG:urllib3.connectionpool:Setting read timeout to None
DEBUG:urllib3.connectionpool:"POST /servicios/hotel_servicio/call/json/listHotel/ HTTP/1.1" 200 None
INFO:urllib3.connectionpool:Starting new HTTP connection (1): servicio
DEBUG:urllib3.connectionpool:Setting read timeout to None
DEBUG:urllib3.connectionpool:"POST /servicios/hotel_servicio/call/json/listHotel/ HTTP/1.1" 403 13
======================================================================
FAIL: Esta definicion comprobara de que en caso de no poseer la llave
----------------------------------------------------------------------
Traceback (most recent call last):
  File "applications/apprueba/test/controllers/default.py", line 42, in test_ListarHotelesSinLlave
    self.assertTrue(resp['jsonBoolean'],'Devolvio json')
AssertionError: Devolvio json

----------------------------------------------------------------------
Ran 4 tests in 0.344s

FAILED (failures=1)

The xml file:

<testsuite name="nosetests" tests="0" errors="0" failures="0" skip="0"/>

回答1:


The module Xunit from nosetest is not compatible when you are using suites.

I made a custom xml and solved my problem.



来源:https://stackoverflow.com/questions/32744626/trying-to-run-nosetests-outputing-with-xunit-and-using-suite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!