pytest-dev / pytest-dev/pytest-html

only 10 test cases but got 20 passed after using pytest-html plugin.

Open
#508 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
779
Forks
260
PR merge metrics
No merged PRs in 30d

Description

(allBase39) ➜  temp tree
.
├── pytest.ini
├── temp
│   └── index.html
└── testaaa.py


(allBase39) ➜  temp cat testaaa.py
import pytest
class Testaseryhdsdaaaaa:
    def test_adf(self):
        pass

class Testertqwetaaaaa:
    def test_adfs(self):
        pass

class Testasaaaa:
    def test_adfe(self):
        pass

class Testbbbbbb:
    def test_aaaaasssa(self):
        pass

    def test_aaadaaasssammmm(self):
        pass

    def test_aaadaaasssa3(self):
        pass

    def test_aaadaaasssa0(self):
        pass

    def test_aaaajjladaaassaaasa0(self):
        pass

    def test_aaadaaasadfsaaasa0(self):
        pass

    def test_aaadaaassaadaasa0(self):
        pass


(allBase39) ➜  temp cat pytest.ini
[pytest]
xfail_strict = true
log_level = info
log_format = %(message)s
log_cli = true
log_cli_level = info
log_cli_format = %(message)s
python_files = test*.py



(allBase39) ➜  temp pytest
Test session starts (platform: darwin, Python 3.9.7, pytest 6.2.5, pytest-sugar 0.9.4)
rootdir: /Users/xtemp/temp, configfile: pytest.ini
plugins: sugar-0.9.4, allure-pytest-2.9.45, html-3.1.1, metadata-1.11.0, xdist-2.4.0, timer-0.0.11, timeout-1.4.2, json-report-1.4.0
collecting ...
 testaaa.py::Testaseryhdsdaaaaa.test_adf ✓                                                                                              10% █
 testaaa.py::Testertqwetaaaaa.test_adfs ✓                                                                                               20% ██
 testaaa.py::Testasaaaa.test_adfe ✓                                                                                                     30% ███
 testaaa.py::Testbbbbbb.test_aaaaasssa ✓                                                                                                40% ████
 testaaa.py::Testbbbbbb.test_aaadaaasssammmm ✓                                                                                          50% █████
 testaaa.py::Testbbbbbb.test_aaadaaasssa3 ✓                                                                                             60% ██████
 testaaa.py::Testbbbbbb.test_aaadaaasssa0 ✓                                                                                             70% ███████
 testaaa.py::Testbbbbbb.test_aaaajjladaaassaaasa0 ✓                                                                                     80% ████████
 testaaa.py::Testbbbbbb.test_aaadaaasadfsaaasa0 ✓                                                                                       90% █████████
 testaaa.py::Testbbbbbb.test_aaadaaassaadaasa0 ✓                                                                                       100% ██████████
==================================================================== pytest-timer ====================================================================
[success] 17.85% testaaa.py::Testbbbbbb::test_aaadaaasssa3: 0.0004s
[success] 12.36% testaaa.py::Testbbbbbb::test_aaadaaassaadaasa0: 0.0003s
[success] 9.86% testaaa.py::Testaseryhdsdaaaaa::test_adf: 0.0002s
[success] 9.47% testaaa.py::Testertqwetaaaaa::test_adfs: 0.0002s
[success] 8.98% testaaa.py::Testbbbbbb::test_aaadaaasssammmm: 0.0002s
[success] 8.75% testaaa.py::Testasaaaa::test_adfe: 0.0002s
[success] 8.48% testaaa.py::Testbbbbbb::test_aaadaaasssa0: 0.0002s
[success] 8.31% testaaa.py::Testbbbbbb::test_aaaaasssa: 0.0002s
[success] 7.99% testaaa.py::Testbbbbbb::test_aaadaaasadfsaaasa0: 0.0002s
[success] 7.95% testaaa.py::Testbbbbbb::test_aaaajjladaaassaaasa0: 0.0002s

Results (0.05s):
      10 passed

after change pytest.ini

(allBase39) ➜  temp cat pytest.ini
[pytest]
xfail_strict = true
log_level = info
log_format = %(message)s
log_cli = true
log_cli_level = info
log_cli_format = %(message)s
addopts = --html=temp/index.html --self-contained-html
python_files = test*.py




(allBase39) ➜  temp pytest
Test session starts (platform: darwin, Python 3.9.7, pytest 6.2.5, pytest-sugar 0.9.4)
rootdir: /Users/xtemp/temp, configfile: pytest.ini
plugins: sugar-0.9.4, allure-pytest-2.9.45, html-3.1.1, metadata-1.11.0, xdist-2.4.0, timer-0.0.11, timeout-1.4.2, json-report-1.4.0
collecting ...
 testaaa.py::Testaseryhdsdaaaaa.test_adf ✓                                                                                              10% █
 testaaa.py::Testertqwetaaaaa.test_adfs ✓                                                                                               20% ██
 testaaa.py::Testasaaaa.test_adfe ✓                                                                                                     30% ███
 testaaa.py::Testbbbbbb.test_aaaaasssa ✓                                                                                                40% ████
 testaaa.py::Testbbbbbb.test_aaadaaasssammmm ✓                                                                                          50% █████
 testaaa.py::Testbbbbbb.test_aaadaaasssa3 ✓                                                                                             60% ██████
 testaaa.py::Testbbbbbb.test_aaadaaasssa0 ✓                                                                                             70% ███████
 testaaa.py::Testbbbbbb.test_aaaajjladaaassaaasa0 ✓                                                                                     80% ████████
 testaaa.py::Testbbbbbb.test_aaadaaasadfsaaasa0 ✓                                                                                       90% █████████
 testaaa.py::Testbbbbbb.test_aaadaaassaadaasa0 ✓                                                                                       100% ██████████

==================================================================== pytest-timer ====================================================================
[success] 8.93% testaaa.py::Testaseryhdsdaaaaa::test_adf: 0.0007s
[success] 8.28% testaaa.py::Testbbbbbb::test_aaadaaasssammmm: 0.0007s
[success] 8.19% testaaa.py::Testasaaaa::test_adfe: 0.0007s
[success] 8.12% testaaa.py::Testbbbbbb::test_aaadaaasadfsaaasa0: 0.0007s
[success] 7.98% testaaa.py::Testertqwetaaaaa::test_adfs: 0.0007s
[success] 7.56% testaaa.py::Testbbbbbb::test_aaadaaasssa3: 0.0006s
[success] 6.96% testaaa.py::Testbbbbbb::test_aaaaasssa: 0.0006s
[success] 6.54% testaaa.py::Testbbbbbb::test_aaaajjladaaassaaasa0: 0.0005s
[success] 6.54% testaaa.py::Testbbbbbb::test_aaadaaassaadaasa0: 0.0005s
[success] 6.53% testaaa.py::Testbbbbbb::test_aaadaaasssa0: 0.0005s
[success] 3.33% testaaa.py::Testasaaaa::test_adfe: 0.0003s
[success] 2.52% testaaa.py::Testertqwetaaaaa::test_adfs: 0.0002s
[success] 2.44% testaaa.py::Testbbbbbb::test_aaadaaasssammmm: 0.0002s
[success] 2.40% testaaa.py::Testaseryhdsdaaaaa::test_adf: 0.0002s
[success] 2.35% testaaa.py::Testbbbbbb::test_aaaaasssa: 0.0002s
[success] 2.32% testaaa.py::Testbbbbbb::test_aaadaaasssa3: 0.0002s
[success] 2.31% testaaa.py::Testbbbbbb::test_aaaajjladaaassaaasa0: 0.0002s
[success] 2.26% testaaa.py::Testbbbbbb::test_aaadaaasssa0: 0.0002s
[success] 2.23% testaaa.py::Testbbbbbb::test_aaadaaassaadaasa0: 0.0002s
[success] 2.22% testaaa.py::Testbbbbbb::test_aaadaaasadfsaaasa0: 0.0002s

Results (0.04s):
      20 passed

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction files testaaa.py and pytest.ini, especially addopts, and inspect the generated temp/index.html. Run pytest with and without --html=temp/index.html --self-contained-html and compare the report entries with the 10 collected tests. Done means the HTML report records each test once and still reports 10 passed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.