pytest-dev / pytest-dev/pytest

Regression in testdir fixture

Open
#12,726 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plugin: unittest type: regression
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

You can see further details in our Dependabot PR: https://github.com/aio-libs/aiohttp/pull/8704

Basically, upgrading from 8.1.1 seems to have caused one of our tests to fail (I think there was another regression in 8.2 which has been fixed, so not sure if this was introduced in 8.2 or 8.3). The code is:

def test_testcase_no_app(
    testdir: pytest.Testdir, loop: asyncio.AbstractEventLoop
) -> None:
    testdir.makepyfile(
        """
        from aiohttp.test_utils import AioHTTPTestCase


        class InvalidTestCase(AioHTTPTestCase):
            def test_noop(self) -> None:
                pass
        """
    )
    result = testdir.runpytest()
    result.stdout.fnmatch_lines(["*TypeError*"])

The logged output from pytest says that it's collected 0 items. My first guess is that the default filename may have changed, thus causing pytest to not find any test files? According to the documentation, I believe the default filename should be test_testcase_no_app.py.

Contributor guide

Open the contributing guide

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 test_testcase_no_app fixture and the linked Dependabot PR #8704, then run the shown test to confirm why pytest collects zero items after the dependency upgrade. Compare the expected default filename, test_testcase_no_app.py, with the observed behavior; done means the regression is identified and the test again reaches the expected TypeError assertion.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.