Skip to content

0.8.1: pytest is failing because cannot find module named is_always_missing #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kloczek opened this issue Jan 6, 2022 · 9 comments
Closed

Comments

@kloczek
Copy link

kloczek commented Jan 6, 2022

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask where I can find that is_always_missing module? I canmot find it on pypi :/
Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mypy-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mypy-0.8.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1, configfile: tox.ini, testpaths: tests
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
collected 50 items

tests/test_pytest_mypy.py ............FFF...................................                                                                                         [100%]

================================================================================= FAILURES =================================================================================
_________________________________________________________________ test_mypy_ignore_missings_imports[True] __________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0')>, xdist_args = ['-n', 'auto']

    def test_mypy_ignore_missings_imports(testdir, xdist_args):
        """
        Verify that --mypy-ignore-missing-imports
        causes mypy to ignore missing imports.
        """
        module_name = "is_always_missing"
        testdir.makepyfile(
            """
                try:
                    import {module_name}
                except ImportError:
                    pass
            """.format(
                module_name=module_name,
            ),
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
        mypy_file_checks = 1
        mypy_status_check = 1
        mypy_checks = mypy_file_checks + mypy_status_check
        result.assert_outcomes(failed=mypy_checks)
>       result.stdout.fnmatch_lines(
            [
                "2: error: Cannot find *module named '{module_name}'".format(
                    module_name=module_name,
                ),
            ],
        )
E       Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
E           and: '============================= test session starts =============================='
E           and: 'platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0'
E           and: 'rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0'
E           and: 'plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7'
E           and: 'gw0 I / gw1 I / gw2 I / gw3 I / gw4 I / gw5 I / gw6 I / gw7 I / gw8 I / gw9 I / gw10 I / gw11 I'
E           and: 'gw0 [2] / gw1 [2] / gw2 [2] / gw3 [2] / gw4 [2] / gw5 [2] / gw6 [2] / gw7 [2] / gw8 [2] / gw9 [2] / gw10 [2] / gw11 [2]'
E           and: ''
E           and: 'FF                                                                       [100%]'
E           and: '=================================== FAILURES ==================================='
E           and: '_________________________________ test session _________________________________'
E           and: '[gw1] linux -- Python 3.8.12 /usr/bin/python3'
E           and: 'mypy exited with status 1.'
E           and: '_____________________ test_mypy_ignore_missings_imports.py _____________________'
E           and: '[gw0] linux -- Python 3.8.12 /usr/bin/python3'
E           and: '2: error: Cannot find implementation or library stub for module named "is_always_missing"'
E           and: '2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports'
E           and: '===================================== mypy ====================================='
E           and: 'Found 1 error in 1 file (checked 1 source file)'
E           and: '=========================== short test summary info ============================'
E           and: 'FAILED test_mypy_ignore_missings_imports.py::mypy-status'
E           and: 'FAILED test_mypy_ignore_missings_imports.py::mypy'
E           and: '============================== 2 failed in 13.08s =============================='
E       remains unmatched: "2: error: Cannot find *module named 'is_always_missing'"

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:119: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports0
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
gw0 I / gw1 I / gw2 I / gw3 I / gw4 I / gw5 I / gw6 I / gw7 I / gw8 I / gw9 I / gw10 I / gw11 I
gw0 [2] / gw1 [2] / gw2 [2] / gw3 [2] / gw4 [2] / gw5 [2] / gw6 [2] / gw7 [2] / gw8 [2] / gw9 [2] / gw10 [2] / gw11 [2]

FF                                                                       [100%]
=================================== FAILURES ===================================
_________________________________ test session _________________________________
[gw1] linux -- Python 3.8.12 /usr/bin/python3
mypy exited with status 1.
_____________________ test_mypy_ignore_missings_imports.py _____________________
[gw0] linux -- Python 3.8.12 /usr/bin/python3
2: error: Cannot find implementation or library stub for module named "is_always_missing"
2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
===================================== mypy =====================================
Found 1 error in 1 file (checked 1 source file)
=========================== short test summary info ============================
FAILED test_mypy_ignore_missings_imports.py::mypy-status
FAILED test_mypy_ignore_missings_imports.py::mypy
============================== 2 failed in 13.08s ==============================
_________________________________________________________________ test_mypy_ignore_missings_imports[False] _________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1')>, xdist_args = []

    def test_mypy_ignore_missings_imports(testdir, xdist_args):
        """
        Verify that --mypy-ignore-missing-imports
        causes mypy to ignore missing imports.
        """
        module_name = "is_always_missing"
        testdir.makepyfile(
            """
                try:
                    import {module_name}
                except ImportError:
                    pass
            """.format(
                module_name=module_name,
            ),
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
        mypy_file_checks = 1
        mypy_status_check = 1
        mypy_checks = mypy_file_checks + mypy_status_check
        result.assert_outcomes(failed=mypy_checks)
>       result.stdout.fnmatch_lines(
            [
                "2: error: Cannot find *module named '{module_name}'".format(
                    module_name=module_name,
                ),
            ],
        )
E       Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
E           and: '============================= test session starts =============================='
E           and: 'platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0'
E           and: 'rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1'
E           and: 'plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7'
E           and: 'collected 2 items'
E           and: ''
E           and: 'test_mypy_ignore_missings_imports.py FF                                  [100%]'
E           and: ''
E           and: '=================================== FAILURES ==================================='
E           and: '_____________________ test_mypy_ignore_missings_imports.py _____________________'
E           and: '2: error: Cannot find implementation or library stub for module named "is_always_missing"'
E           and: '2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports'
E           and: '_________________________________ test session _________________________________'
E           and: 'mypy exited with status 1.'
E           and: '===================================== mypy ====================================='
E           and: 'Found 1 error in 1 file (checked 1 source file)'
E           and: '=========================== short test summary info ============================'
E           and: 'FAILED test_mypy_ignore_missings_imports.py::mypy'
E           and: 'FAILED test_mypy_ignore_missings_imports.py::mypy-status'
E           and: '============================== 2 failed in 11.33s =============================='
E       remains unmatched: "2: error: Cannot find *module named 'is_always_missing'"

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:119: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1/runpytest-0 --mypy
     in: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports1
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
collected 2 items

test_mypy_ignore_missings_imports.py FF                                  [100%]

=================================== FAILURES ===================================
_____________________ test_mypy_ignore_missings_imports.py _____________________
2: error: Cannot find implementation or library stub for module named "is_always_missing"
2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_________________________________ test session _________________________________
mypy exited with status 1.
===================================== mypy =====================================
Found 1 error in 1 file (checked 1 source file)
=========================== short test summary info ============================
FAILED test_mypy_ignore_missings_imports.py::mypy
FAILED test_mypy_ignore_missings_imports.py::mypy-status
============================== 2 failed in 11.33s ==============================
_________________________________________________________________ test_mypy_ignore_missings_imports[None] __________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2')>, xdist_args = ['-p', 'no:xdist']

    def test_mypy_ignore_missings_imports(testdir, xdist_args):
        """
        Verify that --mypy-ignore-missing-imports
        causes mypy to ignore missing imports.
        """
        module_name = "is_always_missing"
        testdir.makepyfile(
            """
                try:
                    import {module_name}
                except ImportError:
                    pass
            """.format(
                module_name=module_name,
            ),
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
        mypy_file_checks = 1
        mypy_status_check = 1
        mypy_checks = mypy_file_checks + mypy_status_check
        result.assert_outcomes(failed=mypy_checks)
>       result.stdout.fnmatch_lines(
            [
                "2: error: Cannot find *module named '{module_name}'".format(
                    module_name=module_name,
                ),
            ],
        )
E       Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
E           and: '============================= test session starts =============================='
E           and: 'platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0'
E           and: 'rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2'
E           and: 'plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7'
E           and: 'collected 2 items'
E           and: ''
E           and: 'test_mypy_ignore_missings_imports.py FF                                  [100%]'
E           and: ''
E           and: '=================================== FAILURES ==================================='
E           and: '_____________________ test_mypy_ignore_missings_imports.py _____________________'
E           and: '2: error: Cannot find implementation or library stub for module named "is_always_missing"'
E           and: '2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports'
E           and: '_________________________________ test session _________________________________'
E           and: 'mypy exited with status 1.'
E           and: '===================================== mypy ====================================='
E           and: 'Found 1 error in 1 file (checked 1 source file)'
E           and: '=========================== short test summary info ============================'
E           and: 'FAILED test_mypy_ignore_missings_imports.py::mypy'
E           and: 'FAILED test_mypy_ignore_missings_imports.py::mypy-status'
E           and: '============================== 2 failed in 11.25s =============================='
E       remains unmatched: "2: error: Cannot find *module named 'is_always_missing'"

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:119: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2/runpytest-0 --mypy -p no:xdist
     in: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2
============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /tmp/pytest-of-tkloczko/pytest-551/test_mypy_ignore_missings_imports2
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0, cov-3.0.0, cases-3.6.7, flake8-1.0.7
collected 2 items

test_mypy_ignore_missings_imports.py FF                                  [100%]

=================================== FAILURES ===================================
_____________________ test_mypy_ignore_missings_imports.py _____________________
2: error: Cannot find implementation or library stub for module named "is_always_missing"
2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_________________________________ test session _________________________________
mypy exited with status 1.
===================================== mypy =====================================
Found 1 error in 1 file (checked 1 source file)
=========================== short test summary info ============================
FAILED test_mypy_ignore_missings_imports.py::mypy
FAILED test_mypy_ignore_missings_imports.py::mypy-status
============================== 2 failed in 11.25s ==============================
========================================================================= short test summary info ==========================================================================
FAILED tests/test_pytest_mypy.py::test_mypy_ignore_missings_imports[True] - Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
FAILED tests/test_pytest_mypy.py::test_mypy_ignore_missings_imports[False] - Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
FAILED tests/test_pytest_mypy.py::test_mypy_ignore_missings_imports[None] - Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"
================================================================= 3 failed, 47 passed in 588.13s (0:09:48) =================================================================
@kloczek kloczek changed the title 0.8.1: pytest is failing because cannot find module named 'is_always_missing' 0.8.1: pytest is failing because cannot find module named is_always_missing Jan 6, 2022
@dmtucker
Copy link
Collaborator

dmtucker commented Jan 6, 2022

is_always_missing does not exist. It's made up so that the import in that test always fails.

The problem appears to be that the quotes have changed... We're looking for single quotes:

E       Failed: nomatch: "2: error: Cannot find *module named 'is_always_missing'"

But we're encountering double quotes:

E           and: '2: error: Cannot find implementation or library stub for module named "is_always_missing"'

What version of mypy are you using?

@kloczek
Copy link
Author

kloczek commented Jan 6, 2022

What version of mypy are you using?

0.910.

@dmtucker
Copy link
Collaborator

dmtucker commented Jan 8, 2022

The quotes were changed in 0.900: python/mypy@0e7b867#diff-ad419c230fdadf186f17fbee963b2c0431a94d935d0204fe1297d336e8fe99e6L58-R65

Strange that the tests aren't reliably reproducing this issue for me 🤔

@dmtucker
Copy link
Collaborator

dmtucker commented Jan 8, 2022

Heh... Oh ya, because this was fixed (in #121) already 😅
4b0a8bf#diff-093d0f2d27a21035bec7f8eab1a87200cbc335ac4533c92c1cfc88b3704e6955L121-R121
The fix just hasn't been released...

Are you working with a clone or an sdist?

@kloczek
Copy link
Author

kloczek commented Jan 9, 2022

I think that we can postpone for few days this issue.
Will back when will sort out mypy test suite issues (which I still needs to report :P ) and upgrade my rpm package to the latest version 0.931 :)

@kloczek
Copy link
Author

kloczek commented Jan 14, 2022

OK I have updated mypy to 0.931.
I've added to my buuild ptocedure all (4) patches from master.

However pytest still is failing in multiple units 😞
Here is the pytest result:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mypy-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-mypy-0.8.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1, configfile: tox.ini, testpaths: tests
plugins: mypy-0.8.1, timeout-2.0.2
collected 50 items

tests/test_pytest_mypy.py FF....F..F..F..F..F..F..F..F..F..FF....F..F..FFF..                                                                                         [100%]

================================================================================= FAILURES =================================================================================
________________________________________________________________________ test_mypy_success[True-1] _________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_success0')>, pyfile_count = 1, xdist_args = ['-n', 'auto']

    @pytest.mark.parametrize("pyfile_count", [1, 2])
    def test_mypy_success(testdir, pyfile_count, xdist_args):
        """Verify that running on a module with no type errors passes."""
        testdir.makepyfile(
            **{
                "pyfile_{0}".format(
                    pyfile_i,
                ): """
                    def pyfunc(x: int) -> int:
                        return x * 2
                """
                for pyfile_i in range(pyfile_count)
            },
        )
        result = testdir.runpytest_subprocess(*xdist_args)
>       result.assert_outcomes()

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:39:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_success0/runpytest-0 -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_success0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_success0

________________________________________________________________________ test_mypy_success[True-2] _________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_success1')>, pyfile_count = 2, xdist_args = ['-n', 'auto']

    @pytest.mark.parametrize("pyfile_count", [1, 2])
    def test_mypy_success(testdir, pyfile_count, xdist_args):
        """Verify that running on a module with no type errors passes."""
        testdir.makepyfile(
            **{
                "pyfile_{0}".format(
                    pyfile_i,
                ): """
                    def pyfunc(x: int) -> int:
                        return x * 2
                """
                for pyfile_i in range(pyfile_count)
            },
        )
        result = testdir.runpytest_subprocess(*xdist_args)
>       result.assert_outcomes()

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:39:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_success1/runpytest-0 -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_success1
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_success1

___________________________________________________________________________ test_mypy_pyi[True] ____________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_pyi0')>, xdist_args = ['-n', 'auto']

    def test_mypy_pyi(testdir, xdist_args):
        """
        Verify that a .py file will be skipped if
        a .pyi file exists with the same filename.
        """
        # The incorrect signature below should be ignored
        # as the .pyi file takes priority
        testdir.makepyfile(
            pyfile="""
                def pyfunc(x: int) -> str:
                    return x * 2
            """,
        )

        testdir.makefile(
            ".pyi",
            pyfile="""
                def pyfunc(x: int) -> int: ...
            """,
        )

        result = testdir.runpytest_subprocess(*xdist_args)
>       result.assert_outcomes()

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:70:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_pyi0/runpytest-0 -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_pyi0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_pyi0

__________________________________________________________________________ test_mypy_error[True] ___________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_error0')>, xdist_args = ['-n', 'auto']

    def test_mypy_error(testdir, xdist_args):
        """Verify that running on a module with type errors fails."""
        testdir.makepyfile(
            """
                def pyfunc(x: int) -> str:
                    return x * 2
            """,
        )
        result = testdir.runpytest_subprocess(*xdist_args)
>       result.assert_outcomes()

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:88:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_error0/runpytest-0 -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_error0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_error0

_________________________________________________________________ test_mypy_ignore_missings_imports[True] __________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_ignore_missings_imports0')>, xdist_args = ['-n', 'auto']

    def test_mypy_ignore_missings_imports(testdir, xdist_args):
        """
        Verify that --mypy-ignore-missing-imports
        causes mypy to ignore missing imports.
        """
        module_name = "is_always_missing"
        testdir.makepyfile(
            """
                try:
                    import {module_name}
                except ImportError:
                    pass
            """.format(
                module_name=module_name,
            ),
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
        mypy_file_checks = 1
        mypy_status_check = 1
        mypy_checks = mypy_file_checks + mypy_status_check
>       result.assert_outcomes(failed=mypy_checks)

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:118:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_ignore_missings_imports0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_ignore_missings_imports0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_ignore_missings_imports0

__________________________________________________________________________ test_mypy_marker[True] __________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_marker0')>, xdist_args = ['-n', 'auto']

    def test_mypy_marker(testdir, xdist_args):
        """Verify that -m mypy only runs the mypy tests."""
        testdir.makepyfile(
            """
                def test_fails():
                    assert False
            """,
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
        test_count = 1
        mypy_file_checks = 1
        mypy_status_check = 1
        mypy_checks = mypy_file_checks + mypy_status_check
>       result.assert_outcomes(failed=test_count, passed=mypy_checks)

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:145:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_marker0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_marker0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_marker0

________________________________________________________________________ test_non_mypy_error[True] _________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_non_mypy_error0')>, xdist_args = ['-n', 'auto']

    def test_non_mypy_error(testdir, xdist_args):
        """Verify that non-MypyError exceptions are passed through the plugin."""
        message = "This is not a MypyError."
        testdir.makepyfile(
            conftest="""
                def pytest_configure(config):
                    plugin = config.pluginmanager.getplugin('mypy')

                    class PatchedMypyFileItem(plugin.MypyFileItem):
                        def runtest(self):
                            raise Exception('{message}')

                    plugin.MypyFileItem = PatchedMypyFileItem
            """.format(
                message=message,
            ),
        )
        result = testdir.runpytest_subprocess(*xdist_args)
>       result.assert_outcomes()

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:170:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_non_mypy_error0/runpytest-0 -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_non_mypy_error0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_non_mypy_error0

__________________________________________________________________________ test_mypy_stderr[True] __________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_stderr0')>, xdist_args = ['-n', 'auto']

    def test_mypy_stderr(testdir, xdist_args):
        """Verify that stderr from mypy is printed."""
        stderr = "This is stderr from mypy."
        testdir.makepyfile(
            conftest="""
                import mypy.api

                def _patched_run(*args, **kwargs):
                    return '', '{stderr}', 1

                mypy.api.run = _patched_run
            """.format(
                stderr=stderr,
            ),
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
>       result.stdout.fnmatch_lines([stderr])
E       Failed: remains unmatched: 'This is stderr from mypy.'

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:198: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_stderr0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_stderr0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_stderr0

_____________________________________________________________________ test_mypy_unmatched_stdout[True] _____________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_unmatched_stdout0')>, xdist_args = ['-n', 'auto']

    def test_mypy_unmatched_stdout(testdir, xdist_args):
        """Verify that unexpected output on stdout from mypy is printed."""
        stdout = "This is unexpected output on stdout from mypy."
        testdir.makepyfile(
            conftest="""
                import mypy.api

                def _patched_run(*args, **kwargs):
                    return '{stdout}', '', 1

                mypy.api.run = _patched_run
            """.format(
                stdout=stdout,
            ),
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
>       result.stdout.fnmatch_lines([stdout])
E       Failed: remains unmatched: 'This is unexpected output on stdout from mypy.'

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:217: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_unmatched_stdout0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_unmatched_stdout0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_unmatched_stdout0

_________________________________________________________________________ test_api_mypy_argv[True] _________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_api_mypy_argv0')>, xdist_args = ['-n', 'auto']

    def test_api_mypy_argv(testdir, xdist_args):
        """Ensure that the plugin can be configured in a conftest.py."""
        testdir.makepyfile(
            conftest="""
                def pytest_configure(config):
                    plugin = config.pluginmanager.getplugin('mypy')
                    plugin.mypy_argv.append('--version')
            """,
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
>       assert result.ret == 0
E       assert <ExitCode.USAGE_ERROR: 4> == 0
E        +  where <ExitCode.USAGE_ERROR: 4> = <RunResult ret=ExitCode.USAGE_ERROR len(stdout.lines)=0 len(stderr.lines)=5 duration=0.33s>.ret

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:230: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_api_mypy_argv0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_api_mypy_argv0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_api_mypy_argv0

________________________________________________________________________ test_api_nodeid_name[True] ________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_api_nodeid_name0')>, xdist_args = ['-n', 'auto']

    def test_api_nodeid_name(testdir, xdist_args):
        """Ensure that the plugin can be configured in a conftest.py."""
        nodeid_name = "UnmistakableNodeIDName"
        testdir.makepyfile(
            conftest="""
                def pytest_configure(config):
                    plugin = config.pluginmanager.getplugin('mypy')
                    plugin.nodeid_name = '{}'
            """.format(
                nodeid_name,
            ),
        )
        result = testdir.runpytest_subprocess("--mypy", "--verbose", *xdist_args)
>       result.stdout.fnmatch_lines(["*conftest.py::" + nodeid_name + "*"])
E       Failed: remains unmatched: '*conftest.py::UnmistakableNodeIDName*'

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:246: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_api_nodeid_name0/runpytest-0 --mypy --verbose -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_api_nodeid_name0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_api_nodeid_name0

____________________________________________________________________ test_mypy_indirect[True-__init__] _____________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect0')>, xdist_args = ['-n', 'auto'], module_name = '__init__'

    @pytest.mark.parametrize(
        "module_name",
        [
            pytest.param(
                "__init__",
                marks=pytest.mark.xfail(
                    (3, 10) <= PYTEST_VERSION < (6, 2),
                    raises=AssertionError,
                    reason="https://github.com/pytest-dev/pytest/issues/8016",
                ),
            ),
            "good",
        ],
    )
    def test_mypy_indirect(testdir, xdist_args, module_name):
        """Verify that uncollected files checked by mypy cause a failure."""
        testdir.makepyfile(
            bad="""
                def pyfunc(x: int) -> str:
                    return x * 2
            """,
        )
        pyfile = testdir.makepyfile(
            **{
                module_name: """
                    import bad
                """,
            },
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args, str(pyfile))
        mypy_file_checks = 1
        mypy_status_check = 1
>       result.assert_outcomes(passed=mypy_file_checks, failed=mypy_status_check)

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:282:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect0/runpytest-0 --mypy -n auto /tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect0/__init__.py
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect0

______________________________________________________________________ test_mypy_indirect[True-good] _______________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect1')>, xdist_args = ['-n', 'auto'], module_name = 'good'

    @pytest.mark.parametrize(
        "module_name",
        [
            pytest.param(
                "__init__",
                marks=pytest.mark.xfail(
                    (3, 10) <= PYTEST_VERSION < (6, 2),
                    raises=AssertionError,
                    reason="https://github.com/pytest-dev/pytest/issues/8016",
                ),
            ),
            "good",
        ],
    )
    def test_mypy_indirect(testdir, xdist_args, module_name):
        """Verify that uncollected files checked by mypy cause a failure."""
        testdir.makepyfile(
            bad="""
                def pyfunc(x: int) -> str:
                    return x * 2
            """,
        )
        pyfile = testdir.makepyfile(
            **{
                module_name: """
                    import bad
                """,
            },
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args, str(pyfile))
        mypy_file_checks = 1
        mypy_status_check = 1
>       result.assert_outcomes(passed=mypy_file_checks, failed=mypy_status_check)

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:282:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect1/runpytest-0 --mypy -n auto /tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect1/good.py
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect1
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_indirect1

______________________________________________________________________ test_api_error_formatter[True] ______________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_api_error_formatter0')>, xdist_args = ['-n', 'auto']

    def test_api_error_formatter(testdir, xdist_args):
        """Ensure that the plugin can be configured in a conftest.py."""
        testdir.makepyfile(
            bad="""
                def pyfunc(x: int) -> str:
                    return x * 2
            """,
        )
        testdir.makepyfile(
            conftest="""
                def custom_file_error_formatter(item, results, errors):
                    return '\\n'.join(
                        '{path}:{error}'.format(
                            path=item.fspath,
                            error=error,
                        )
                        for error in errors
                    )

                def pytest_configure(config):
                    plugin = config.pluginmanager.getplugin('mypy')
                    plugin.file_error_formatter = custom_file_error_formatter
            """,
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
>       result.stdout.fnmatch_lines(["*/bad.py:2: error: Incompatible return value*"])
E       Failed: remains unmatched: '*/bad.py:2: error: Incompatible return value*'

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:311: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_api_error_formatter0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_api_error_formatter0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_api_error_formatter0

___________________________________________________________________________ test_setup_cfg[True] ___________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_setup_cfg0')>, xdist_args = ['-n', 'auto']

    def test_setup_cfg(testdir, xdist_args):
        """Ensure that the plugin allows configuration with setup.cfg."""
        testdir.makefile(
            ".cfg",
            setup="""
                [mypy]
                disallow_untyped_defs = True
            """,
        )
        testdir.makepyfile(
            conftest="""
                def pyfunc(x):
                    return x * 2
            """,
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
>       result.stdout.fnmatch_lines(["1: error: Function is missing a type annotation"])
E       Failed: remains unmatched: '1: error: Function is missing a type annotation'

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:331: Failed
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_setup_cfg0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_setup_cfg0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_setup_cfg0

________________________________________________________________________ test_looponfail[__init__] _________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_looponfail0')>, module_name = '__init__'

    @pytest.mark.parametrize("module_name", ["__init__", "test_demo"])
    def test_looponfail(testdir, module_name):
        """Ensure that the plugin works with --looponfail."""

        pass_source = textwrap.dedent(
            """\
            def pyfunc(x: int) -> int:
                return x * 2
            """,
        )
        fail_source = textwrap.dedent(
            """\
            def pyfunc(x: int) -> str:
                return x * 2
            """,
        )
        pyfile = testdir.makepyfile(**{module_name: fail_source})
        looponfailroot = testdir.mkdir("looponfailroot")
        looponfailroot_pyfile = looponfailroot.join(pyfile.basename)
        pyfile.move(looponfailroot_pyfile)
        pyfile = looponfailroot_pyfile
        testdir.makeini(
            textwrap.dedent(
                """\
                [pytest]
                looponfailroots = {looponfailroots}
                """.format(
                    looponfailroots=looponfailroot,
                ),
            ),
        )

        child = testdir.spawn_pytest(
            "--mypy --looponfail " + str(pyfile),
            expect_timeout=30.0,
        )

        num_tests = 2
        if module_name == "__init__" and (3, 10) <= PYTEST_VERSION < (6, 2):
            # https://github.com/pytest-dev/pytest/issues/8016
            # Pytest had a bug where it assumed only a Package would have a basename of
            # __init__.py. In this test, Pytest mistakes MypyFile for a Package and
            # returns after collecting only one object (the MypyFileItem).
            num_tests = 1

        def _expect_session():
            child.expect("==== test session starts ====")

        def _expect_failure():
            _expect_session()
            child.expect("==== FAILURES ====")
            child.expect(pyfile.basename + " ____")
            child.expect("2: error: Incompatible return value")
            # if num_tests == 2:
            #     # These only show with mypy>=0.730:
            #     child.expect("==== mypy ====")
            #     child.expect("Found 1 error in 1 file (checked 1 source file)")
            child.expect(str(num_tests) + " failed")
            child.expect("#### LOOPONFAILING ####")
            _expect_waiting()

        def _expect_waiting():
            child.expect("#### waiting for changes ####")
            child.expect("Watching")

        def _fix():
            pyfile.write(pass_source)
            _expect_changed()
            _expect_success()

        def _expect_changed():
            child.expect("MODIFIED " + str(pyfile))

        def _expect_success():
            for _ in range(2):
                _expect_session()
                # if num_tests == 2:
                #     # These only show with mypy>=0.730:
                #     child.expect("==== mypy ====")
                #     child.expect("Success: no issues found in 1 source file")
                try:
                    child.expect(str(num_tests) + " passed")
                except pexpect.exceptions.TIMEOUT:
                    if module_name == "__init__" and (6, 0) <= PYTEST_VERSION < (6, 2):
                        # MypyItems hit the __init__.py bug too when --looponfail
                        # re-collects them after the failing file is modified.
                        # Unlike MypyFile, MypyItem is not a Collector, so this used
                        # to cause an AttributeError until a workaround was added
                        # (MypyItem.collect was defined to yield itself).
                        # Mypy probably noticed the __init__.py problem during the
                        # development of Pytest 6.0, but the error was addressed
                        # with an isinstance assertion, which broke the workaround.
                        # Here, we hit that assertion:
                        child.expect("AssertionError")
                        child.expect("1 error")
                        pytest.xfail("https://github.com/pytest-dev/pytest/issues/8016")
                    raise
            _expect_waiting()

        def _break():
            pyfile.write(fail_source)
            _expect_changed()
            _expect_failure()

>       _expect_failure()

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:439:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:384: in _expect_failure
    _expect_session()
/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:381: in _expect_session
    child.expect("==== test session starts ====")
/usr/lib/python3.8/site-packages/pexpect/spawnbase.py:343: in expect
    return self.expect_list(compiled_pattern_list,
/usr/lib/python3.8/site-packages/pexpect/spawnbase.py:372: in expect_list
    return exp.expect_loop(timeout)
/usr/lib/python3.8/site-packages/pexpect/expect.py:179: in expect_loop
    return self.eof(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pexpect.expect.Expecter object at 0x7f1c33c45100>, err = EOF('End Of File (EOF). Exception style platform.')

    def eof(self, err=None):
        spawn = self.spawn

        spawn.before = spawn._before.getvalue()
        spawn._buffer = spawn.buffer_type()
        spawn._before = spawn.buffer_type()
        spawn.after = EOF
        index = self.searcher.eof_index
        if index >= 0:
            spawn.match = EOF
            spawn.match_index = index
            return index
        else:
            spawn.match = None
            spawn.match_index = None
            msg = str(spawn)
            msg += '\nsearcher: %s' % self.searcher
            if err is not None:
                msg = str(err) + '\n' + msg

            exc = EOF(msg)
            exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
>           raise exc
E           pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
E           <pexpect.pty_spawn.spawn object at 0x7f1c33c45580>
E           command: /usr/bin/python3
E           args: ['/usr/bin/python3', '-mpytest', '--basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_looponfail0/temp-pexpect', '--mypy', '--looponfail', '/tmp/pytest-of-tkloczko/pytest-57/test_looponfail0/looponfailroot/__init__.py']
E           buffer (last 100 chars): b''
E           before (last 100 chars): b'ytest-57/test_looponfail0/tox.ini\r\n  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_looponfail0\r\n\r\n'
E           after: <class 'pexpect.exceptions.EOF'>
E           match: None
E           match_index: None
E           exitstatus: None
E           flag_eof: True
E           pid: 2942620
E           child_fd: 16
E           closed: False
E           timeout: 30.0
E           delimiter: <class 'pexpect.exceptions.EOF'>
E           logfile: <_io.BufferedWriter name='/tmp/pytest-of-tkloczko/pytest-57/test_looponfail0/spawn.out'>
E           logfile_read: None
E           logfile_send: None
E           maxread: 2000
E           ignorecase: False
E           searchwindowsize: None
E           delaybeforesend: 0.05
E           delayafterclose: 0.1
E           delayafterterminate: 0.1
E           searcher: searcher_re:
E               0: re.compile(b'==== test session starts ====')

/usr/lib/python3.8/site-packages/pexpect/expect.py:122: EOF
________________________________________________________________________ test_looponfail[test_demo] ________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_looponfail1')>, module_name = 'test_demo'

    @pytest.mark.parametrize("module_name", ["__init__", "test_demo"])
    def test_looponfail(testdir, module_name):
        """Ensure that the plugin works with --looponfail."""

        pass_source = textwrap.dedent(
            """\
            def pyfunc(x: int) -> int:
                return x * 2
            """,
        )
        fail_source = textwrap.dedent(
            """\
            def pyfunc(x: int) -> str:
                return x * 2
            """,
        )
        pyfile = testdir.makepyfile(**{module_name: fail_source})
        looponfailroot = testdir.mkdir("looponfailroot")
        looponfailroot_pyfile = looponfailroot.join(pyfile.basename)
        pyfile.move(looponfailroot_pyfile)
        pyfile = looponfailroot_pyfile
        testdir.makeini(
            textwrap.dedent(
                """\
                [pytest]
                looponfailroots = {looponfailroots}
                """.format(
                    looponfailroots=looponfailroot,
                ),
            ),
        )

        child = testdir.spawn_pytest(
            "--mypy --looponfail " + str(pyfile),
            expect_timeout=30.0,
        )

        num_tests = 2
        if module_name == "__init__" and (3, 10) <= PYTEST_VERSION < (6, 2):
            # https://github.com/pytest-dev/pytest/issues/8016
            # Pytest had a bug where it assumed only a Package would have a basename of
            # __init__.py. In this test, Pytest mistakes MypyFile for a Package and
            # returns after collecting only one object (the MypyFileItem).
            num_tests = 1

        def _expect_session():
            child.expect("==== test session starts ====")

        def _expect_failure():
            _expect_session()
            child.expect("==== FAILURES ====")
            child.expect(pyfile.basename + " ____")
            child.expect("2: error: Incompatible return value")
            # if num_tests == 2:
            #     # These only show with mypy>=0.730:
            #     child.expect("==== mypy ====")
            #     child.expect("Found 1 error in 1 file (checked 1 source file)")
            child.expect(str(num_tests) + " failed")
            child.expect("#### LOOPONFAILING ####")
            _expect_waiting()

        def _expect_waiting():
            child.expect("#### waiting for changes ####")
            child.expect("Watching")

        def _fix():
            pyfile.write(pass_source)
            _expect_changed()
            _expect_success()

        def _expect_changed():
            child.expect("MODIFIED " + str(pyfile))

        def _expect_success():
            for _ in range(2):
                _expect_session()
                # if num_tests == 2:
                #     # These only show with mypy>=0.730:
                #     child.expect("==== mypy ====")
                #     child.expect("Success: no issues found in 1 source file")
                try:
                    child.expect(str(num_tests) + " passed")
                except pexpect.exceptions.TIMEOUT:
                    if module_name == "__init__" and (6, 0) <= PYTEST_VERSION < (6, 2):
                        # MypyItems hit the __init__.py bug too when --looponfail
                        # re-collects them after the failing file is modified.
                        # Unlike MypyFile, MypyItem is not a Collector, so this used
                        # to cause an AttributeError until a workaround was added
                        # (MypyItem.collect was defined to yield itself).
                        # Mypy probably noticed the __init__.py problem during the
                        # development of Pytest 6.0, but the error was addressed
                        # with an isinstance assertion, which broke the workaround.
                        # Here, we hit that assertion:
                        child.expect("AssertionError")
                        child.expect("1 error")
                        pytest.xfail("https://github.com/pytest-dev/pytest/issues/8016")
                    raise
            _expect_waiting()

        def _break():
            pyfile.write(fail_source)
            _expect_changed()
            _expect_failure()

>       _expect_failure()

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:439:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:384: in _expect_failure
    _expect_session()
/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:381: in _expect_session
    child.expect("==== test session starts ====")
/usr/lib/python3.8/site-packages/pexpect/spawnbase.py:343: in expect
    return self.expect_list(compiled_pattern_list,
/usr/lib/python3.8/site-packages/pexpect/spawnbase.py:372: in expect_list
    return exp.expect_loop(timeout)
/usr/lib/python3.8/site-packages/pexpect/expect.py:179: in expect_loop
    return self.eof(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pexpect.expect.Expecter object at 0x7f1c339738e0>, err = EOF('End Of File (EOF). Exception style platform.')

    def eof(self, err=None):
        spawn = self.spawn

        spawn.before = spawn._before.getvalue()
        spawn._buffer = spawn.buffer_type()
        spawn._before = spawn.buffer_type()
        spawn.after = EOF
        index = self.searcher.eof_index
        if index >= 0:
            spawn.match = EOF
            spawn.match_index = index
            return index
        else:
            spawn.match = None
            spawn.match_index = None
            msg = str(spawn)
            msg += '\nsearcher: %s' % self.searcher
            if err is not None:
                msg = str(err) + '\n' + msg

            exc = EOF(msg)
            exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
>           raise exc
E           pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
E           <pexpect.pty_spawn.spawn object at 0x7f1c33973a00>
E           command: /usr/bin/python3
E           args: ['/usr/bin/python3', '-mpytest', '--basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_looponfail1/temp-pexpect', '--mypy', '--looponfail', '/tmp/pytest-of-tkloczko/pytest-57/test_looponfail1/looponfailroot/test_demo.py']
E           buffer (last 100 chars): b''
E           before (last 100 chars): b'ytest-57/test_looponfail1/tox.ini\r\n  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_looponfail1\r\n\r\n'
E           after: <class 'pexpect.exceptions.EOF'>
E           match: None
E           match_index: None
E           exitstatus: None
E           flag_eof: True
E           pid: 2942622
E           child_fd: 17
E           closed: False
E           timeout: 30.0
E           delimiter: <class 'pexpect.exceptions.EOF'>
E           logfile: <_io.BufferedWriter name='/tmp/pytest-of-tkloczko/pytest-57/test_looponfail1/spawn.out'>
E           logfile_read: None
E           logfile_send: None
E           maxread: 2000
E           ignorecase: False
E           searchwindowsize: None
E           delaybeforesend: 0.05
E           delayafterclose: 0.1
E           delayafterterminate: 0.1
E           searcher: searcher_re:
E               0: re.compile(b'==== test session starts ====')

/usr/lib/python3.8/site-packages/pexpect/expect.py:122: EOF
_______________________________________________________________________ test_mypy_item_collect[True] _______________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-57/test_mypy_item_collect0')>, xdist_args = ['-n', 'auto']

    def test_mypy_item_collect(testdir, xdist_args):
        """Ensure coverage for a 3.10<=pytest<6.0 workaround."""
        testdir.makepyfile(
            """
            def test_mypy_item_collect(request):
                plugin = request.config.pluginmanager.getplugin("mypy")
                mypy_items = [
                    item
                    for item in request.session.items
                    if isinstance(item, plugin.MypyItem)
                ]
                assert mypy_items
                for mypy_item in mypy_items:
                    assert all(item is mypy_item for item in mypy_item.collect())
            """,
        )
        result = testdir.runpytest_subprocess("--mypy", *xdist_args)
        test_count = 1
        mypy_file_checks = 1
        mypy_status_check = 1
>       result.assert_outcomes(passed=test_count + mypy_file_checks + mypy_status_check)

/home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1/tests/test_pytest_mypy.py:466:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/pytester.py:542: in parseoutcomes
    return self.parse_summary_nouns(self.outlines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class '_pytest.pytester.RunResult'>, lines = []

    @classmethod
    def parse_summary_nouns(cls, lines) -> Dict[str, int]:
        """Extract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        """
        for line in reversed(lines):
            if rex_session_duration.search(line):
                outcomes = rex_outcome.findall(line)
                ret = {noun: int(count) for (count, noun) in outcomes}
                break
        else:
>           raise ValueError("Pytest terminal summary report not found")
E           ValueError: Pytest terminal summary report not found

/usr/lib/python3.8/site-packages/_pytest/pytester.py:560: ValueError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
running: /usr/bin/python3 -mpytest --basetemp=/tmp/pytest-of-tkloczko/pytest-57/test_mypy_item_collect0/runpytest-0 --mypy -n auto
     in: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_item_collect0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n
  inifile: None
  rootdir: /tmp/pytest-of-tkloczko/pytest-57/test_mypy_item_collect0

========================================================================= short test summary info ==========================================================================
FAILED tests/test_pytest_mypy.py::test_mypy_success[True-1] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_mypy_success[True-2] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_mypy_pyi[True] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_mypy_error[True] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_mypy_ignore_missings_imports[True] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_mypy_marker[True] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_non_mypy_error[True] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_mypy_stderr[True] - Failed: remains unmatched: 'This is stderr from mypy.'
FAILED tests/test_pytest_mypy.py::test_mypy_unmatched_stdout[True] - Failed: remains unmatched: 'This is unexpected output on stdout from mypy.'
FAILED tests/test_pytest_mypy.py::test_api_mypy_argv[True] - assert <ExitCode.USAGE_ERROR: 4> == 0
FAILED tests/test_pytest_mypy.py::test_api_nodeid_name[True] - Failed: remains unmatched: '*conftest.py::UnmistakableNodeIDName*'
FAILED tests/test_pytest_mypy.py::test_mypy_indirect[True-__init__] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_mypy_indirect[True-good] - ValueError: Pytest terminal summary report not found
FAILED tests/test_pytest_mypy.py::test_api_error_formatter[True] - Failed: remains unmatched: '*/bad.py:2: error: Incompatible return value*'
FAILED tests/test_pytest_mypy.py::test_setup_cfg[True] - Failed: remains unmatched: '1: error: Function is missing a type annotation'
FAILED tests/test_pytest_mypy.py::test_looponfail[__init__] - pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
FAILED tests/test_pytest_mypy.py::test_looponfail[test_demo] - pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
FAILED tests/test_pytest_mypy.py::test_mypy_item_collect[True] - ValueError: Pytest terminal summary report not found
================================================================ 18 failed, 32 passed in 162.28s (0:02:42) =================================================================

@dmtucker
Copy link
Collaborator

dmtucker commented Jan 14, 2022

ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: -n

Looks like you need to install pytest-xdist.

@kloczek
Copy link
Author

kloczek commented Jan 14, 2022

sh*t .. one sec :)

@kloczek
Copy link
Author

kloczek commented Jan 14, 2022

OK closing.
All is fine 😄

+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-mypy-0.8.1, configfile: tox.ini, testpaths: tests
plugins: mypy-0.8.1, forked-1.4.0, xdist-2.5.0
collected 50 items

tests/test_pytest_mypy.py ..................................................                                                                                         [100%]

====================================================================== 50 passed in 290.96s (0:04:50) ======================================================================

@kloczek kloczek closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants