Code Monkey home page Code Monkey logo

pytest-json-report-viewer's Introduction

Pytest Json Report Viewer.

You run Pytest on many github action matrix element.

You want a breakdown on the elements that take the most time.

You use pytest with --duration but it's still hard to distinguish what is slow, especially with parametrized test.

Fear not, this is for you. This will give you a treemap breakdown of test durations, and you can choose how to breakdown the levels, for example you can aggregate time for each tests, regardless of GitHub action matrix element. Or decide to look only at parametrized tests.

Here is a screen shot example of napari test suite time breakdown, default view:

Removing the file in which the test are defined, summing across all 11 matrix element of github action, and adding a breakdown per item in @pytest.markparametrize:

configure GH Action to get artifacts:

Dependencies:

  • add pytest-json-report to your test suite.

Tox:

If you are using tox in GHA add:

--json-report --json-report-file={toxinidir}/report-{envname}.json

Non TOX:

TODO

upload artifacts:

After running the test:

- uses: actions/upload-artifact@v3
  with:
    name: upload pytest timing reports as json
    path: |
      ./report-*.json

You will be able to download artifacts from the test summary "artifact download" section.

pytest-json-report-viewer's People

Contributors

carreau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pytest-json-report-viewer's Issues

Better GH integration.

We could likely add a pytest plugin that upload the results directly to a KV store.
It could know about github action and automatically extract the matrix parameters,
and post a link on the issue to view the results without having to download/drag/drop.

Different aggregate method + skipped tests.

Right now the aggregate is sum. And the color is related to fail/mixed/passed.

I think other aggregate could be of interest: most disparity in time, min time, max time. Average time.

Not sure how to handle that exactly.

I'm also not sure how to handled skipped test, I'd like to show them but they inherently have no time. So maybe a minimal size/time ? Or a size time that is not linear but affine, so that there is still some scaling ?

update D3.

I had no clue what I was doing, I think that uses an older d3 library. Maybe make a newer one ?

FIgure out more generic parameters splitting.

Currently we don't do anything smart with the json files names:

eg: report-py38-linux-pyqt.json, could be split into 3 categories: python-version; os; qt-binding and be offered as independent dropdown options.

This is something to figure out

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.