python-trio / pytest-trio

Pytest plugin for trio
Other
54 stars 25 forks source link

0.7.0: pytesty is failing #122

Open kloczek opened 3 years ago

kloczek commented 3 years ago

I'm trying to package your module as rpm packag. So I'm using typical in such case build, install and test cycle used on building package from non-root account:

May I ask for help because few units are failing:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.7.0-5.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.7.0-5.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -qq
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-trio-0.7.0, configfile: pytest.ini
plugins: trio-0.7.0, forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, toolbox-0.5, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, hypothesis-6.14.4, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0
collected 66 items

_tests/test_async_fixture.py ....x                                                                                                                                   [  7%]
_tests/test_async_yield_fixture.py ..........FF..                                                                                                                    [ 28%]
_tests/test_basic.py ..x                                                                                                                                             [ 33%]
_tests/test_clock_fixture.py .                                                                                                                                       [ 34%]
_tests/test_contextvars.py .                                                                                                                                         [ 36%]
_tests/test_fixture_mistakes.py ..............                                                                                                                       [ 57%]
_tests/test_fixture_names.py .                                                                                                                                       [ 59%]
_tests/test_fixture_nursery.py F                                                                                                                                     [ 60%]
_tests/test_fixture_ordering.py ......                                                                                                                               [ 69%]
_tests/test_hypothesis_interaction.py .......                                                                                                                        [ 80%]
_tests/test_sync_fixture.py ....                                                                                                                                     [ 86%]
_tests/test_trio_mode.py .........                                                                                                                                   [100%]Coverage.py warning: No data was collected. (no-data-collected)

================================================================================= FAILURES =================================================================================
____________________________________________________________ test_async_yield_fixture_with_nursery[Python>=36] _____________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-33/test_async_yield_fixture_with_nursery0')>
async_yield_implementation = <function async_yield_implementation.<locals>.patch_code at 0x7f6541620310>

    def test_async_yield_fixture_with_nursery(testdir, async_yield_implementation):

        testdir.makepyfile(
            async_yield_implementation(
                """
            import pytest
            import trio
            from async_generator import async_generator, yield_

            async def handle_client(stream):
                while True:
                    buff = await stream.receive_some(4)
                    await stream.send_all(buff)

            @pytest.fixture
            @async_generator
            async def server():
                async with trio.open_nursery() as nursery:
                    listeners = await nursery.start(trio.serve_tcp, handle_client, 0)
                    await yield_(listeners[0])
                    nursery.cancel_scope.cancel()

            @pytest.mark.trio
            async def test_actual_test(server):
                stream = await trio.testing.open_stream_to_socket_listener(server)
                await stream.send_all(b'ping')
                rep = await stream.receive_some(4)
                assert rep == b'ping'
        """
            )
        )

        result = testdir.runpytest()

>       result.assert_outcomes(passed=1)
E       AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
E         Omitting 4 identical items, use -vv to show
E         Differing items:
E         {'passed': 0} != {'passed': 1}
E         {'failed': 1} != {'failed': 0}
E         Use -v to get the full diff

/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.7.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_trio/_tests/test_async_yield_fixture.py:303: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /tmp/pytest-of-tkloczko/pytest-33/test_async_yield_fixture_with_nursery0
plugins: trio-0.7.0, forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, toolbox-0.5, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, hypothesis-6.14.4, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0
collected 1 item

test_async_yield_fixture_with_nursery.py F                               [100%]

=================================== FAILURES ===================================
_______________________________ test_actual_test _______________________________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7f65415acca0>
when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.8/site-packages/_pytest/runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:255: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.8/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.8/site-packages/pluggy/manager.py:337: in traced_hookexec
    return outcome.get_result()
/usr/lib/python3.8/site-packages/pluggy/manager.py:335: in <lambda>
    outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
/usr/lib/python3.8/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:88: in pytest_runtest_call
    yield from unraisable_exception_runtest_hook()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def unraisable_exception_runtest_hook() -> Generator[None, None, None]:
        with catch_unraisable_exception() as cm:
            yield
            if cm.unraisable:
                if cm.unraisable.err_msg is not None:
                    err_msg = cm.unraisable.err_msg
                else:
                    err_msg = "Exception ignored in"
                msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
                msg += "".join(
                    traceback.format_exception(
                        cm.unraisable.exc_type,
                        cm.unraisable.exc_value,
                        cm.unraisable.exc_traceback,
                    )
                )
>               warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E               pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
E
E               Traceback (most recent call last):
E                 File "/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.7.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_trio/plugin.py", line 252, in run
E                   await self._func(**resolved_kwargs)
E               ResourceWarning: unclosed <socket.socket fd=27, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 58022), raddr=('127.0.0.1', 38539)>

/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning
=========================== short test summary info ============================
FAILED test_async_yield_fixture_with_nursery.py::test_actual_test - pytest.Py...
============================== 1 failed in 0.16s ===============================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
__________________________________________________________ test_async_yield_fixture_with_nursery[async_generator] __________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-tkloczko/pytest-33/test_async_yield_fixture_with_nursery1')>
async_yield_implementation = <function async_yield_implementation.<locals>.<lambda> at 0x7f65415a4430>

    def test_async_yield_fixture_with_nursery(testdir, async_yield_implementation):

        testdir.makepyfile(
            async_yield_implementation(
                """
            import pytest
            import trio
            from async_generator import async_generator, yield_

            async def handle_client(stream):
                while True:
                    buff = await stream.receive_some(4)
                    await stream.send_all(buff)

            @pytest.fixture
            @async_generator
            async def server():
                async with trio.open_nursery() as nursery:
                    listeners = await nursery.start(trio.serve_tcp, handle_client, 0)
                    await yield_(listeners[0])
                    nursery.cancel_scope.cancel()

            @pytest.mark.trio
            async def test_actual_test(server):
                stream = await trio.testing.open_stream_to_socket_listener(server)
                await stream.send_all(b'ping')
                rep = await stream.receive_some(4)
                assert rep == b'ping'
        """
            )
        )

        result = testdir.runpytest()

>       result.assert_outcomes(passed=1)
E       AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...pped': 0, ...}
E         Omitting 4 identical items, use -vv to show
E         Differing items:
E         {'passed': 0} != {'passed': 1}
E         {'failed': 1} != {'failed': 0}
E         Use -v to get the full diff

/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.7.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_trio/_tests/test_async_yield_fixture.py:303: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /tmp/pytest-of-tkloczko/pytest-33/test_async_yield_fixture_with_nursery1
plugins: trio-0.7.0, forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, toolbox-0.5, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, hypothesis-6.14.4, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0
collected 1 item

test_async_yield_fixture_with_nursery.py F                               [100%]

=================================== FAILURES ===================================
_______________________________ test_actual_test _______________________________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7f654153ef70>
when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.8/site-packages/_pytest/runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:255: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.8/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.8/site-packages/pluggy/manager.py:337: in traced_hookexec
    return outcome.get_result()
/usr/lib/python3.8/site-packages/pluggy/manager.py:335: in <lambda>
    outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
/usr/lib/python3.8/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:88: in pytest_runtest_call
    yield from unraisable_exception_runtest_hook()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def unraisable_exception_runtest_hook() -> Generator[None, None, None]:
        with catch_unraisable_exception() as cm:
            yield
            if cm.unraisable:
                if cm.unraisable.err_msg is not None:
                    err_msg = cm.unraisable.err_msg
                else:
                    err_msg = "Exception ignored in"
                msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
                msg += "".join(
                    traceback.format_exception(
                        cm.unraisable.exc_type,
                        cm.unraisable.exc_value,
                        cm.unraisable.exc_traceback,
                    )
                )
>               warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E               pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
E
E               Traceback (most recent call last):
E                 File "/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.7.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_trio/plugin.py", line 252, in run
E                   await self._func(**resolved_kwargs)
E               ResourceWarning: unclosed <socket.socket fd=27, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 37162), raddr=('127.0.0.1', 40377)>

/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning
=========================== short test summary info ============================
FAILED test_async_yield_fixture_with_nursery.py::test_actual_test - pytest.Py...
============================== 1 failed in 0.24s ===============================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
_________________________________________________________________________________ test_try _________________________________________________________________________________

cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x7f6541374b80>, when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.8/site-packages/_pytest/runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:255: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.8/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.8/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:88: in pytest_runtest_call
    yield from unraisable_exception_runtest_hook()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def unraisable_exception_runtest_hook() -> Generator[None, None, None]:
        with catch_unraisable_exception() as cm:
            yield
            if cm.unraisable:
                if cm.unraisable.err_msg is not None:
                    err_msg = cm.unraisable.err_msg
                else:
                    err_msg = "Exception ignored in"
                msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
                msg += "".join(
                    traceback.format_exception(
                        cm.unraisable.exc_type,
                        cm.unraisable.exc_value,
                        cm.unraisable.exc_traceback,
                    )
                )
>               warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E               pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
E
E               Traceback (most recent call last):
E                 File "/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.7.0-5.fc35.x86_64/usr/lib/python3.8/site-packages/pytest_trio/plugin.py", line 252, in run
E                   await self._func(**resolved_kwargs)
E               ResourceWarning: unclosed <socket.socket fd=20, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 38644), raddr=('127.0.0.1', 46149)>

/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning

---------- coverage: platform linux, python 3.8.11-final-0 -----------
Name                                                Stmts   Miss    Cover
-------------------------------------------------------------------------
pytest_trio/__init__.py                                 3      3     0.0%
pytest_trio/_tests/__init__.py                          0      0   100.0%
pytest_trio/_tests/conftest.py                          1      1     0.0%
pytest_trio/_tests/helpers.py                           8      8     0.0%
pytest_trio/_tests/test_async_fixture.py               22     22     0.0%
pytest_trio/_tests/test_async_yield_fixture.py         41     41     0.0%
pytest_trio/_tests/test_basic.py                       14     14     0.0%
pytest_trio/_tests/test_clock_fixture.py               10     10     0.0%
pytest_trio/_tests/test_contextvars.py                 26     26     0.0%
pytest_trio/_tests/test_fixture_mistakes.py            41     41     0.0%
pytest_trio/_tests/test_fixture_names.py               12     12     0.0%
pytest_trio/_tests/test_fixture_nursery.py             15     15     0.0%
pytest_trio/_tests/test_fixture_ordering.py            29     29     0.0%
pytest_trio/_tests/test_hypothesis_interaction.py      34     34     0.0%
pytest_trio/_tests/test_sync_fixture.py                20     20     0.0%
pytest_trio/_tests/test_trio_mode.py                   53     53     0.0%
pytest_trio/_version.py                                 1      1     0.0%
pytest_trio/enable_trio_mode.py                         6      6     0.0%
pytest_trio/plugin.py                                 241    241     0.0%
-------------------------------------------------------------------------
TOTAL                                                 577    577     0.0%

========================================================================= short test summary info ==========================================================================
XFAIL _tests/test_async_fixture.py::test_raise_in_async_fixture_cause_pytest_error
  Not implemented yet
XFAIL _tests/test_basic.py::test_sync_function_with_trio_mark
  Raises pytest internal error so far...
FAILED _tests/test_async_yield_fixture.py::test_async_yield_fixture_with_nursery[Python>=36] - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0,...p...
FAILED _tests/test_async_yield_fixture.py::test_async_yield_fixture_with_nursery[async_generator] - AssertionError: assert {'errors': 0,...pped': 0, ...} == {'errors': 0...
FAILED _tests/test_fixture_nursery.py::test_try - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=AddressFamily.AF_INET, type...
================================================================= 3 failed, 61 passed, 2 xfailed in 18.17s =================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
njsmith commented 3 years ago

Looks like there's some socket that's not getting closed properly, and it's causing spurious failures in the test suite. Not really anything to worry about, but we should still fix it.

pquentin commented 3 years ago

pytest-trio currently pins pytest to 6.1.2, and the pytest exception looks like it's a recent one, which is probably why the test suite is failing with pytest 6.2.4.

kloczek commented 3 years ago

pytest-trio currently pins pytest to 6.1.2, and the pytest exception looks like it's a recent one, which is probably why the test suite is failing with pytest 6.2.4.

I can confirm that I'm using pytest 6.2.4.

kloczek commented 2 years ago

Any updates for latest pytest? :P (just asking :) )

jgarte commented 1 year ago

Hi, any updates on this?

pquentin commented 1 year ago

@jgarte Yes, latest pytest is supported in 0.8.0.

@kloczek We don't support running our tests outside of our ci.sh script.

Closing.

kloczek commented 11 months ago

Just tested 0.8.0 and pytests is now failing on collecting units

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.8.0-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-trio-0.8.0-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0 -- /usr/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/tkloczko/rpmbuild/BUILD/pytest-trio-0.8.0/.hypothesis/examples')
rootdir: /home/tkloczko/rpmbuild/BUILD/pytest-trio-0.8.0
configfile: pytest.ini
plugins: trio-0.8.0, mypy-0.10.3, black-0.3.12, flake8-1.1.1, checkdocs-2.10.1, enabler-2.3.1, cov-4.1.0, hypothesis-6.84.3
collected 0 items / 1 error
/usr/lib64/python3.8/site-packages/coverage/control.py:883: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")

========================================================================================== ERRORS ===========================================================================================
_______________________________________________________________________________ ERROR collecting test session _______________________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/nodes.py:141: in _create
    return super().__call__(*k, **kw)
E   TypeError: __init__() got an unexpected keyword argument 'path'

During handling of the above exception, another exception occurred:
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/main.py:717: in collect
    col = self._collectfile(pkginit, handle_dupes=False)
/usr/lib/python3.8/site-packages/_pytest/main.py:602: in _collectfile
    return ihook.pytest_collect_file(file_path=fspath, parent=self)  # type: ignore[no-any-return]
/usr/lib/python3.8/site-packages/_pytest/config/compat.py:66: in fixed_hook
    return hook(**kw)
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pytest_black.py:27: in pytest_collect_file
    return BlackItem.from_parent(parent, fspath=path)
/usr/lib/python3.8/site-packages/_pytest/nodes.py:649: in from_parent
    return super().from_parent(parent=parent, fspath=fspath, path=path, **kw)
/usr/lib/python3.8/site-packages/_pytest/nodes.py:264: in from_parent
    return cls._create(parent=parent, **kw)
/usr/lib/python3.8/site-packages/_pytest/nodes.py:156: in _create
    return super().__call__(*k, **known_kw)
/usr/lib/python3.8/site-packages/pytest_black.py:47: in __init__
    super(BlackItem, self).__init__(fspath, parent)
/usr/lib/python3.8/site-packages/_pytest/nodes.py:702: in __init__
    self._check_item_and_collector_diamond_inheritance()
/usr/lib/python3.8/site-packages/_pytest/nodes.py:724: in _check_item_and_collector_diamond_inheritance
    warnings.warn(
E   pytest.PytestWarning: BlackItem is an Item subclass and should not be a collector, however its bases File are collectors.
E   Please split the Collectors and the Item into separate node types.
E   Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html
E   example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/
===================================================================================== warnings summary ======================================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:147
  /usr/lib/python3.8/site-packages/_pytest/nodes.py:147: PytestDeprecationWarning: <class 'pytest_black.BlackItem'> is not using a cooperative constructor and only takes {'parent', 'fspath'}.
  See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.
    warnings.warn(

../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:264
  /usr/lib/python3.8/site-packages/_pytest/nodes.py:264: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to BlackItem is deprecated. Please use the (path: pathlib.Path) argument instead.
  See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
    return cls._create(parent=parent, **kw)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.8.18-final-0 -----------
Name                                                Stmts   Miss  Cover
-----------------------------------------------------------------------
pytest_trio/__init__.py                                 3      3   0.0%
pytest_trio/_tests/__init__.py                          0      0 100.0%
pytest_trio/_tests/conftest.py                          1      1   0.0%
pytest_trio/_tests/helpers.py                           8      8   0.0%
pytest_trio/_tests/test_async_fixture.py               22     22   0.0%
pytest_trio/_tests/test_async_yield_fixture.py         29     29   0.0%
pytest_trio/_tests/test_basic.py                       18     18   0.0%
pytest_trio/_tests/test_clock_fixture.py               10     10   0.0%
pytest_trio/_tests/test_contextvars.py                 26     26   0.0%
pytest_trio/_tests/test_fixture_mistakes.py            41     41   0.0%
pytest_trio/_tests/test_fixture_names.py               12     12   0.0%
pytest_trio/_tests/test_fixture_nursery.py             15     15   0.0%
pytest_trio/_tests/test_fixture_ordering.py            33     33   0.0%
pytest_trio/_tests/test_hypothesis_interaction.py      34     34   0.0%
pytest_trio/_tests/test_sync_fixture.py                20     20   0.0%
pytest_trio/_tests/test_trio_mode.py                   53     53   0.0%
pytest_trio/_version.py                                 1      1   0.0%
pytest_trio/enable_trio_mode.py                         6      6   0.0%
pytest_trio/plugin.py                                 255    255   0.0%
-----------------------------------------------------------------------
TOTAL                                                 587    587   0.0%

================================================================================== short test summary info ==================================================================================
ERROR  - pytest.PytestWarning: BlackItem is an Item subclass and should not be a collector, however its bases File are collectors.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================================================== 2 warnings, 1 error in 0.39s ================================================================================
kloczek commented 9 months ago

I'll reopen this ticket as issue seems still is not resolved