Plugin for generating HTML reports for pytest results

Overview
Comments
  • Garbage date-time is printed in the Captured log.

    Garbage date-time is printed in the Captured log.

    Garbage date-time is printed in the Captured log.

    pytest-html report:

    ------------------------------ Captured log setup ------------------------------ INFO  root:test_cyclic_switchover.py:26 Inside Setup INFO  root:test_cyclic_switchover.py:54 ------------------------------ Captured log call ------------------------------- INFO  root:test_cyclic_switchover.py:82 Switchover Process : SCM

    pytest console log :

    collected 4 items / 2 deselected / 2 selected

    test_cyclic_switchover.py::test_process_switchover[SCM] ------------------------------------------------------------ live log setup ------------------------------------------------------------- 2020-07-13 21:51:50 [ INFO] Inside Setup (test_cyclic_switchover.py:26) 2020-07-13 21:51:50 [ INFO] (test_cyclic_switchover.py:54) ------------------------------------------------------------- live log call ------------------------------------------------------------- 2020-07-13 21:51:50 [ INFO] Switchover Process : SCM (test_cyclic_switchover.py:82) PASSED [ 50%] test_cyclic_switchover.py::test_process_switchover[SAM] ------------------------------------------------------------- live log call ------------------------------------------------------------- 2020-07-13 21:51:50 [ INFO] Switchover Process : SAM (test_cyclic_switchover.py:82) PASSED [100%] ----------------------------------------------------------- live log teardown ----------------------------------------------------------- 2020-07-13 21:51:50 [ INFO] Inside Teardown (test_cyclic_switchover.py:60)

    opened by pawan7476 20
  • environment table needs to be whitelisted/blacklisted

    environment table needs to be whitelisted/blacklisted

    when I use pytest-html in docker (with gitlab-ci) it needs a lot of environment variables set, some holds token and passwords. I do not want to show in my jenkins report to a wider audience. pytest-html_envs

    It seems they are collected in the very first test, so adding this to a test is working using the request autofixture:

            # remove eventual gitlab settings
            for k in list(request.config._metadata.keys()):
                if re.search(r'^(GITLAB_|CI_)', k):
                    del request.config._metadata[k]
    

    But I like to do it in conftest.py

    enhancement feature 
    opened by fenchu 19
  • Don't include any captured stdout/stderr/log output to the report

    Don't include any captured stdout/stderr/log output to the report

    Hi, To reduce report file size, I'm trying to exclude any captured stdout/stderr/log output. I'm running tests with the following command:

    pytest --html=report.html --self-contained-html --capture=no --show-capture=no tests/
    

    With this I still get the Captured log call section for every test no matter if it pass or not. So the question, how to not include any captured output to the report?

    enhancement help wanted 
    opened by bigunyak 19
  • unrecognized arguments: --html=report.htm

    unrecognized arguments: --html=report.htm

    I see below error when i tried to run my py test

    command tried : pytest test_blank_pages.py --html=report.html

    irb-6672:static cirb_apasunoori$ pytest test_blank_pages.py --html=report.html
    usage: pytest [options] [file_or_dir] [file_or_dir] [...]
    pytest: error: unrecognized arguments: --html=report.html
      inifile: None
      rootdir: /Users/cirb_apasunoori/PycharmProjects/pythonsitecore/static
    irb-6672:static cirb_apasunoori$ 
    
    opened by anand853 18
  • Error or failure information can be collapsed

    Error or failure information can be collapsed

    Hi,

    Could you please add a new feature that user could collapse the error or failure log? it's a little bit hard to find the useful information once there're hundreds of errors or failures in the report. For better understanding, I would like to give an example:

    balabala
    Thanks very much and looking forward for that.

    Regards,

    Hailin

    enhancement 
    opened by hailin-xiao 18
  • Clarifying the release schedule

    Clarifying the release schedule

    Hi everyone.

    I think it may make sense to create a release schedule. I looked at PyPI and it looks like we haven't released a new version of this plugin since March of this year.

    While we're at it, perhaps it would make sense to automate the process as much as possible and create a RELEASING.rst doc similar to pytest's. This way users could be aware of what to expect in terms of feature delivery.

    Thoughts @ssbarnea @BeyondEvil @davehunt ?

    docs packaging Infrastructure 
    opened by gnikonorov 17
  • Post process html to include teardown in log

    Post process html to include teardown in log

    I believe this would resolve #131 ... however it isn't really optimal, I didn't want to dig into the html logic, so instead just moved it to be post processed and tried to coerce the test result into what the existing code seemed to want.

    bug 
    opened by csm10495 17
  • Opening report is slow when it contains long logs

    Opening report is slow when it contains long logs

    I have some test runs that generate a lot of log entries. When opening the report is seems my browser is spending a lot of time presenting all these entries which are immediately collapsed right after.

    If I change the behavior to have everything collapsed by default I can open/render the html report much faster.

    What I have tested is essentially the same as adding a "collapsed" class here https://github.com/pytest-dev/pytest-html/blob/master/pytest_html/plugin.py#L140

    I have no idea if this breaks other use-cases or if other changes are necessary. I also realize that everything related to the collapse functionality is currently in js. Regardless, if something could be done to generate everything collapsed and open the necessary stuff afterwards I believe performance would be a lot better.

    Edit: I should mention I use self-contained reports.

    opened by Wramberg 16
  • Page header does not take environment variables into account

    Page header does not take environment variables into account

    In pytest.ini, I have :

    addopts = --html $APPRENTI_MOTEUR_LOGS_DIR_TEST/$APPRENTI_MOTEUR_LOGS_HTML_NAME
    

    The path of the html report takes the content of the environment variable into account.

    But the page header does not : image

    It would be nice if it would as well :-)

    opened by MaximeWeyl 16
  • Change color for text in HTML report

    Change color for text in HTML report

    Hi!

    First, thank you for this plugin!

    I want to recommend to change font color in report because read grey text on white background is "hard" for eyes. Also if we can increase font size it would be great!

    Thanks in advance!

    opened by APshenkin 15
  • Allow unicode in test names

    Allow unicode in test names

    @The-Compiler unicode hurts my head! I encountered a test with as a parameter. This caused the report to fail due to UnicodeDecodeError. This patch fixes it, but would you mind taking a look to see if there's a smarter approach? I also found it difficult to write a test for this use case.

    opened by davehunt 15
  • pytest --html=report.html, is working locally, but not creating report in GIt repository with help of GitHub Action

    pytest --html=report.html, is working locally, but not creating report in GIt repository with help of GitHub Action

    pytest --html=report.html, is working locally, but not creating report in GIt repository with help of GitHub Action

    in Github action, im expecting report to get created in root directory. but nothing is getting created. can you help?

    Following is my yml file 👍 name: Test Execution for OrangeHRM - Demo Environment on: schedule:

    • cron: '20 * * * *'

    jobs: build:

    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/[email protected]
    - name: Set up Python
      uses: actions/[email protected]
      with:
        python-version: '3.x'
    - name: Install dependencies
      run: |
         python -m pip install --upgrade pip
         pip install setuptools wheel twine
         pip install selenium
         pip install pytest
         pip install PyGithub
         pip install pytest-html
         pip install allure-pytest
         pip install pytest-github-report
         pip install webdriver-manager
         pip install pytest-failed-screenshot
         pip install pytest-metadata
         pip install pytest-cov
    - name: Test Execution after 20 mins interval
      run: |
         pytest --html=report.html
    
    opened by autotaskit 0
  • pytest-html 3.2.0 error on report generation on Gitlab-CI

    pytest-html 3.2.0 error on report generation on Gitlab-CI

    pytest-html 3.2.0 error on report generation on Gitlab-CI Observed: error on report generation NB: we have downgraded to version 3.1.1 and everything works well

    I think the problem is in: Explicitly add py.xml dependency.

    And the issue is the same as: https://github.com/microsoft/pylance-release/issues/2357

    Log: File "/Users/mobile-ci/.pyenv/versions/3.9.16/bin/pytest", line 8, in sys.exit(console_main()) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/config/init.py", line 190, in console_main code = main() File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/config/init.py", line 167, in main ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main( File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in call return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall return outcome.get_result() File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result raise ex[1].with_traceback(ex[2]) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall res = hook_impl.function(*args) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/main.py", line 317, in pytest_cmdline_main return wrap_session(config, _main) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/main.py", line 305, in wrap_session config.hook.pytest_sessionfinish( File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in call return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 55, in _multicall gen.send(outcome) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/terminal.py", line 808, in pytest_sessionfinish outcome.get_result() File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result raise ex[1].with_traceback(ex[2]) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall res = hook_impl.function(*args) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pytest_html/html_report.py", line 332, in pytest_sessionfinish report_content = self._generate_report(session) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pytest_html/html_report.py", line 206, in _generate_report unicode_doc = "\n{}".format(doc.unicode(indent=2)) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 69, in unicode HtmlVisitor(l.append, indent, shortempty=False).visit(self) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit visitmethod(node) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 160, in Tag self.visit(x) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit visitmethod(node) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 160, in Tag self.visit(x) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit visitmethod(node) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 160, in Tag self.visit(x) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit visitmethod(node) File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 140, in list assert id(obj) not in self.visited AssertionError: assert 4500331456 not in {4500220800: 1, 4500222816: 1, 4500259040: 1, 4500259280: 1, ...}

    • where 4500331456 = id([<'span' tag object 4500315888>, <'span' tag object 4500315728>, <'span' tag object 4500315408>, <'span' tag object 4500313728>])
    • and {4500220800: 1, 4500222816: 1, 4500259040: 1, 4500259280: 1, ...} = <py._xmlgen.HtmlVisitor object at 0x10c3bbb20>.visited
    opened by musjaster 0
  • Large img preview in self-contained mode

    Large img preview in self-contained mode

    opened by mganisin 1
  • Changing path of html directory using a fixture value for parametrized test

    Changing path of html directory using a fixture value for parametrized test

    Hello everyone,

    I was wondering if there was a way to change the output path of the html report after the test has run by using a test fixture which contains the name and parametrized values of a test i.e. :

    during the test there is a fixture that creates a directory whose name is based on the values of the current test, for example : output_path = /path/to/test/test_name_parametrized_val1_val2.

    However since the value of the config.option.htmlpath seems to be given during the pytest_configure hook and the tests have not been intialized yet (output_path is not yet created and, even if it was, it is not reachable from the pytest_configure hook) I haven't been able to figure this one out yet.

    I would really appreciate any advice on how to accomplish this and I apologize if the solution is trivial as I'm quite new to pytest...

    Thanks and have a good day!

    next-gen 
    opened by jnunez10010 6
  • Error in html report related to versions

    Error in html report related to versions

    Although the installed versions of pythest html 3.2.0 and meta 1.0.4 in report there is still version 3.1.1. for html report and 1.0.2 for meta. Also, the test execution time is slower than on another computer, and the code is the same. What could be the problem?

    element click intercepted error intercepted

    opened by Vladeemeer 1
Releases(v3.2.0)
  • v3.2.0(Nov 11, 2022)

    Changes

    • Revert "Rename master branch to main" (#562) @BeyondEvil
    • Release v3.2.0 (#556) @BeyondEvil
    • Add py as dependency (#555) @smartEBL
    • pip isn't a build dependency (#516) @rossburton
    • Migrate to precommit.ci (#487) @BeyondEvil
    • Use the tests reusable workflow (#486) @BeyondEvil

    Minor Changes

    • Allow for redacting of environment table values (#431) @gnikonorov
    • Implement the visible URL query parameter to control visibility of test results on page load. (#433) @gnikonorov
    • Make the report tab title reflect the report name (#420) @gnikonorov

    Bugfixes

    • Rename master branch to main (#560) @ssbarnea
    • chore: Deactivate broken test for now (#557) @BeyondEvil
    • Use pathlib.Path for file path handling (#514) @mrlegohead0x45
    • Re-enable tests against latest pytest (#421) @BeyondEvil
    Source code(tar.gz)
    Source code(zip)
  • v3.1.1(Jul 4, 2022)

  • v3.1.0(Jul 4, 2022)

    • Stop attaching test reruns to final test report entries (https://github.com/pytest-dev/pytest-html/issues/374)
    • Allow for report duration formatting (https://github.com/pytest-dev/pytest-html/issues/376)
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0(Jul 4, 2022)

    • Respect --capture=no, --show-capture=no, and -s pytest flags (https://github.com/pytest-dev/pytest-html/issues/171)
    • Make the Results table Links column sortable (https://github.com/pytest-dev/pytest-html/issues/242)
    • Fix issue with missing image or video in extras. (https://github.com/pytest-dev/pytest-html/issues/265 and https://github.com/pytest-dev/pytest-selenium/issues/237) @christiansandberg and @superdodd and @dhalperi for the fix
    • Fix attribute name for compatibility with pytest-xdist 2. (https://github.com/pytest-dev/pytest-html/issues/305)
    • Post process HTML generation to allow teardown to appear in the HTML output. (https://github.com/pytest-dev/pytest-html/issues/131)
    Source code(tar.gz)
    Source code(zip)
  • v3.0.0a0(Nov 12, 2020)

    Changed below are not curated yet and is machine generated. Look at https://github.com/pytest-dev/pytest-html/blob/master/CHANGES.rst for human curated changelist.

    Changes

    • Prep version 3.0.0 for release (#362) @gnikonorov

    Major Changes

    • Stop shadowing the 'format' builtin (#347) @gnikonorov
    • Drop support for legacy Python 2.7 (#230) @hugovk

    Minor Changes

    • Add support for py39 (#345) @ssbarnea
    • Enable py38 testing (#326) @ssbarnea
    • Strip ANSI escape sequences when ansi2html is missing (#315) @BeyondEvil
    • Make the links column in the results table sortable (#324) @gnikonorov
    • Make the maximum asset filename length configurable. (#313) @D3X
    • Fix broken development docs (#316) @BeyondEvil
    • Update link to Tox (#301) @gnikonorov

    Bugfixes

    • Add ESLint to project (#367) @gnikonorov
    • Assure scm versioning is pypa compatible (#364) @ssbarnea
    • Move release from travis to github actions (#360) @ssbarnea
    • Respect --show-capture=no flag (#359) @gnikonorov
    • Respect pytest --capture=no and -s flags (#353) @gnikonorov
    • Stop shadowing the 'format' builtin (#347) @gnikonorov
    • Post process html to include teardown in log (#271) @csm10495
    • Avoid pytest 6.0.0 (#319) @ssbarnea
    • Rename "slave" -> "worker" for xdist compatibility (#307) @Zac-HD
    • Fix embedded images (and videos) (#298) @dhalperi
    • Fix image missing when using Base64 content (#277) @christiansandberg
    • Better fix for TerminalReporter issue (#299) @BeyondEvil
    • Fix collapsable bug (#268) @BeyondEvil
    • Fix min-width which produced horizontal scrolls (#237) @ssbarnea
    • Support utf8 display (#244) @lzhu666
    • Trigger sorting for initial sort column (#248) @wanam
    • Close opened resource. (#235) @krzysztof-pawlik-gat
    • Keep sort preference for previously sorted columns (#220) @wanam
    • Fix assets file naming to work across both *nix and windows (#223) @BeyondEvil
    • Remove unused and undocumented markers (#224) @BeyondEvil
    • Append a line break after captured log sections (#217) @borntyping
    • Handle when report title is stored as an environment variable (#203) @BeyondEvil
    • Removed extraneous space from anchor tag (#192) @chardbury
    • Stop filtering out falsy environment values (#180) @crazymerlyn
    • Always define version even if get_distribution() fails (#178) @nicoddemus
    • Disable sort on environment table when metadata is ordered (#162) @jacebrowning
    • Fix for including a screenshot bug on Windows (#124) (#136) @pinkie1378
    Source code(tar.gz)
    Source code(zip)
Owner
pytest-dev
pytest-dev
A Simple Unit Test Matcher Library for Python 3

pychoir - Python Test Matchers for humans Super duper low cognitive overhead matching for Python developers reading or writing tests. Implemented in p

Antti Kajander 15 Sep 14, 2022
Test scripts etc. for experimental rollup testing

rollup node experiments Test scripts etc. for experimental rollup testing. untested, work in progress python -m venv venv source venv/bin/activate #

Diederik Loerakker 14 Jan 25, 2022
Donors data of Tamil Nadu Chief Ministers Relief Fund scrapped from https://ereceipt.tn.gov.in/cmprf/Interface/CMPRF/MonthWiseReport

Tamil Nadu Chief Minister's Relief Fund Donors Scrapped data from https://ereceipt.tn.gov.in/cmprf/Interface/CMPRF/MonthWiseReport Scrapper scrapper.p

Arunmozhi 5 May 18, 2021
Photostudio是一款能进行自动化检测网页存活并实时给网页拍照的工具,通过调用Fofa/Zoomeye/360qua/shodan等 Api快速准确查询资产并进行网页截图,从而实施进一步的信息筛查。

Photostudio-红队快速爬取网页快照工具 一、简介: 正如其名:这是一款能进行自动化检测,实时给网页拍照的工具 信息收集要求所收集到的信息要真实可靠。 当然,这个原则是信息收集工作的最基本的要求。为达到这样的要求,信息收集者就必须对收集到的信息反复核实,不断检验,力求把误差减少到最低限度。我

s7ck Team 41 Dec 11, 2022
a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)

pytest-sugar pytest-sugar is a plugin for pytest that shows failures and errors instantly and shows a progress bar. Requirements You will need the fol

Teemu 963 Dec 28, 2022
Wraps any WSGI application and makes it easy to send test requests to that application, without starting up an HTTP server.

WebTest This wraps any WSGI application and makes it easy to send test requests to that application, without starting up an HTTP server. This provides

Pylons Project 325 Dec 30, 2022
Public repo for automation scripts

Script_Quickies Public repo for automation scripts Dependencies Chrome webdriver .exe (make sure it matches the version of chrome you are using) Selen

CHR-onicles 1 Nov 04, 2021
Bayesian A/B testing

bayesian_testing is a small package for a quick evaluation of A/B (or A/B/C/...) tests using Bayesian approach.

Matus Baniar 35 Dec 15, 2022
Pytest modified env

Pytest plugin to fail a test if it leaves modified os.environ afterwards.

wemake.services 7 Sep 11, 2022
输入Google Hacking语句,自动调用Chrome浏览器爬取结果

Google-Hacking-Crawler 该脚本可输入Google Hacking语句,自动调用Chrome浏览器爬取结果 环境配置 python -m pip install -r requirements.txt 下载Chrome浏览器

Jarcis 4 Jun 21, 2022
A testing system for catching visual regressions in Web applications.

Huxley Watches you browse, takes screenshots, tells you when they change Huxley is a test-like system for catching visual regressions in Web applicati

Facebook Archive 4.1k Nov 30, 2022
Akulaku Create NewProduct Automation using Selenium Python

Akulaku-Create-NewProduct-Automation Akulaku Create NewProduct Automation using Selenium Python Usage: 1. Install Python 3.9 2. Open CMD on Bot Folde

Rahul Joshua Damanik 1 Nov 22, 2021
This file will contain a series of Python functions that use the Selenium library to search for elements in a web page while logging everything into a file

element_search with Selenium (Now With docstrings 😎 ) Just to mention, I'm a beginner to all this, so it it's very possible to make some mistakes The

2 Aug 12, 2021
API Test Automation with Requests and Pytest

api-testing-requests-pytest Install Make sure you have Python 3 installed on your machine. Then: 1.Install pipenv sudo apt-get install pipenv 2.Go to

Sulaiman Haque 2 Nov 21, 2021
pytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite

pytest_pyramid pytest_pyramid provides basic fixtures for testing pyramid applications with pytest test suite. By default, pytest_pyramid will create

Grzegorz Śliwiński 12 Dec 04, 2022
🐍 Material for PyData Global 2021 Presentation: Effective Testing for Machine Learning Projects

Effective Testing for Machine Learning Projects Code for PyData Global 2021 Presentation by @edublancas. Slides available here. The project is develop

Eduardo Blancas 73 Nov 06, 2022
MultiPy lets you conveniently keep track of your python scripts for personal use or showcase by loading and grouping them into categories. It allows you to either run each script individually or together with just one click.

MultiPy About MultiPy is a graphical user interface built using Dear PyGui Python GUI Framework that lets you conveniently keep track of your python s

56 Oct 29, 2022
Nokia SR OS automation

Nokia SR OS automation Nokia is one of the biggest vendors of the telecommunication equipment, which is very popular in the Service Provider segment.

Karneliuk.com 7 Jul 23, 2022
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. An example o

pytest-dev 9.6k Jan 02, 2023
Code coverage measurement for Python

Coverage.py Code coverage testing for Python. Coverage.py measures code coverage, typically during test execution. It uses the code analysis tools and

Ned Batchelder 2.3k Jan 04, 2023