Git Product home page Git Product logo

flake8-formatter-junit-xml's People

Contributors

astj avatar e3krisztian avatar sigmavirus24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

flake8-formatter-junit-xml's Issues

Pass line and file as text rather than xml attribute

Hi! I have trouble displaying resulting XML with Gitlab test reports feature. Currently, it only shows the source that generated the error and no information for exact place where the error has occurred.

As I understand Gitlab closely follows JUnit XML specification by IBM (or at least they bother to put a link to it from their documentation) and it does not specify file and line attributes for TestCase element. https://www.ibm.com/support/knowledgecenter/en/SSQ2R2_14.1.0/com.ibm.rsar.analysis.codereview.cobol.doc/topics/cac_useresults_junit.html

Could we have an option to write them as plain text output? Either to failure.message or failure.text would be great.

Success output is invalid

The output for success is invalid because it shows no tests have been run.

Here's an example from php-cs-fixer:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="PHP CS Fixer" tests="1" assertions="1" failures="0" errors="0" time="1.392">
    <testcase name="All OK" assertions="1"/>
  </testsuite>
</testsuites>

Here's the output from this formatter:

<?xml version="1.0" ?>
<testsuites disabled="0" errors="0" failures="0" tests="0" time="0.0">
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/TrendingDeploy_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/resources/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/model/model_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/adapter/aerospike_adapter_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/global_config_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/top_sku_category_brand_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/adapter/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/migrations/alembic/env_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/top_sku_category_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/trending/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/logs/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/connection/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/credential/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/migrations/alembic/versions/69d29ab22e1b_create_best_seller_table_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/most_viewed_controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_brand_controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/recently_viewed_controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/top_sku_brand_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/connection/redis_db_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/trending_controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_category_controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/utils/read_files_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/datasource/model/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/validation/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/bestseller/best_seller_category_brand_controller_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/utils/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/migrations/alembic/versions/4589f1620603_create_database_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/best_seller_deploy_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/controller/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/adapter/redis_adapter_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/best_seller/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/most_viewed/__init___py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/deploy/MostViewedDeploy_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/start_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/connection/mysql_db_py" skipped="0" tests="0" time="0"/>
	<testsuite disabled="0" errors="0" failures="0" name="flake8.src/configs/__init___py" skipped="0" tests="0" time="0"/>
</testsuites>

With 0 tests and 0 time Jenkins will not report that this is successful as no tests have been recorded.

Please add classname attribute to testcase elements

GitLab CI requires every testcase to have a classname. I suggest using the Python module name of the file that was tested as classname attribute.

Would it be possible to add this attribute, so report frameworks can use it as key?

Output file is appended to and not replaced

Thanks for this nice project!

What I report below is a minor issue, that surprised me (worked around now).

Running flake8 --format=junit-xml --output-file=flake8.xml twice results in an invalid flake8.xml file (second run's output appended to previous runs output):

$ mkdir empty-dir
$ flake8 --format=junit-xml --output=flake8.xml empty-dir/
$ flake8 --format=junit-xml --output=flake8.xml empty-dir/
$ head flake8.xml 
<?xml version="1.0" ?>
<testsuites/>

<?xml version="1.0" ?>
<testsuites/>

It might be the behavior of flake8 --output-file and not this plugin, however with junit-xml it looked more natural to use the option --output-file than shell-redirect output to file.

Screen Display and File Output

Is there any way with this plugin to output both to a file (using the formatter) and the screen using the default formatting? The --tee option outputs to both file and screen however xml is written to the screen.

Support python2

Please add support for python2:

Traceback (most recent call last):
  File "/Users/harrison/.local/share/virtualenvs/recommendation-feeds-6IquZfue/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/Users/harrison/.local/share/virtualenvs/recommendation-feeds-6IquZfue/lib/python2.7/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/Users/harrison/.local/share/virtualenvs/recommendation-feeds-6IquZfue/lib/python2.7/site-packages/flake8/main/application.py", line 396, in run
    self._run(argv)
  File "/Users/harrison/.local/share/virtualenvs/recommendation-feeds-6IquZfue/lib/python2.7/site-packages/flake8/main/application.py", line 385, in _run
    self.report()
  File "/Users/harrison/.local/share/virtualenvs/recommendation-feeds-6IquZfue/lib/python2.7/site-packages/flake8/main/application.py", line 379, in report
    self.formatter.stop()
  File "/Users/harrison/.local/share/virtualenvs/recommendation-feeds-6IquZfue/lib/python2.7/site-packages/flake8_formatter_junit_xml/formatter.py", line 31, in stop
    super().stop()
TypeError: super() takes at least 1 argument (0 given)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.