Why is Pytest html report not showing tests in the results table?

885 views Asked by At

I have built a very simple set of tests that I'm trying to generate a report for to get the feel of things with Pytest. The report generates as expected, but there is no environment information, and, more importantly, there are no tests in the results table. Here are my tests:

import pytest
import time

# python -m pytest -v -s --html=report.html --self-contained-html test_pytest.py
class TestReports:
    @pytest.fixture
    def setup(self):
        pass
    def test_1(self, setup):
        time.sleep(2)
        assert True
    def test_2(self, setup):
        time.sleep(2)
        assert False

report html

I tried removing the -s command already, and I can't seem to find anything useful online yet. Any idea why tests will not appear in the table (or why the environment details are not present)? Forgive me if it is something obvious.

1

There are 1 answers

1
Michael Mintz On

I'm still using pytest==2.0.1 because I found all later versions to have at least one bug that I wasn't willing to accept. Here's the report that was generated after running your script with that version:

pytest new_file.py --html=report.html