python-greenlet / greenlet

Lightweight in-process concurrent programming
Other
1.63k stars 247 forks source link

3.0.1: pytest is failing in `src/greenlet/tests/test_greenlet.py::TestGreenlet::test_dealloc_catches_GreenletExit_throws_other` unit #380

Closed kloczek closed 10 months ago

kloczek commented 10 months ago

I'm packaging 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.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-greenlet-3.0.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-greenlet-3.0.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --import-mode=importlib ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0 rootdir: /home/tkloczko/rpmbuild/BUILD/greenlet-3.0.1 collected 137 items src/greenlet/tests/test_contextvars.py .........s [ 7%] src/greenlet/tests/test_cpp.py ..... [ 10%] src/greenlet/tests/test_extension_interface.py ........... [ 18%] src/greenlet/tests/test_gc.py .... [ 21%] src/greenlet/tests/test_generator.py . [ 22%] src/greenlet/tests/test_generator_nested.py ..... [ 26%] src/greenlet/tests/test_greenlet.py ...F.............................................................. [ 74%] src/greenlet/tests/test_greenlet_trash.py . [ 75%] src/greenlet/tests/test_leaks.py ............ [ 83%] src/greenlet/tests/test_stack_saved.py . [ 84%] src/greenlet/tests/test_throw.py ....... [ 89%] src/greenlet/tests/test_tracing.py .......... [ 97%] src/greenlet/tests/test_version.py . [ 97%] src/greenlet/tests/test_weakref.py ... [100%] ========================================================================================= FAILURES ========================================================================================== ________________________________________________________________ TestGreenlet.test_dealloc_catches_GreenletExit_throws_other ________________________________________________________________ self = def test_dealloc_catches_GreenletExit_throws_other(self): def run(): try: greenlet.getcurrent().parent.switch() except greenlet.GreenletExit: raise SomeError from None g = RawGreenlet(run) g.switch() # Destroying the only reference to the greenlet causes it # to get GreenletExit; when it in turn raises, even though we're the parent # we don't get the exception, it just gets printed. # When we run on 3.8 only, we can use sys.unraisablehook oldstderr = sys.stderr try: from cStringIO import StringIO except ImportError: from io import StringIO stderr = sys.stderr = StringIO() try: del g finally: sys.stderr = oldstderr v = stderr.getvalue() > self.assertIn("Exception", v) E AssertionError: 'Exception' not found in '' src/greenlet/tests/test_greenlet.py:215: AssertionError ===================================================================================== warnings summary ====================================================================================== src/greenlet/tests/test_greenlet.py::TestGreenlet::test_dealloc_catches_GreenletExit_throws_other /usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: Traceback (most recent call last): File "/home/tkloczko/rpmbuild/BUILD/greenlet-3.0.1/src/greenlet/tests/test_greenlet.py", line 195, in run raise SomeError from None src.greenlet.tests.test_greenlet.SomeError warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================================================== short test summary info ================================================================================== SKIPPED [1] src/greenlet/tests/test_contextvars.py:288: ContextVar supported FAILED src/greenlet/tests/test_greenlet.py::TestGreenlet::test_dealloc_catches_GreenletExit_throws_other - AssertionError: 'Exception' not found in '' =================================================================== 1 failed, 135 passed, 1 skipped, 1 warning in 56.60s ==================================================================== ```

Here is list of installed modules in build env

```console Package Version ----------------------------- ------- alabaster 0.7.13 Babel 2.13.1 build 1.0.0 charset-normalizer 3.3.1 cppclean 0.13 distro 1.8.0 docutils 0.20.1 exceptiongroup 1.1.3 gpg 1.22.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.8.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.2 MarkupSafe 2.1.3 objgraph 3.6.0 packaging 23.2 pluggy 1.3.0 psutil 5.9.5 Pygments 2.16.1 pyproject_hooks 1.0.0 pytest 7.4.3 python-dateutil 2.8.2 pytz 2023.3 requests 2.31.0 setuptools 68.2.2 six 1.16.0 snowballstemmer 2.2.0 Sphinx 7.1.2 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.4 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.9 tomli 2.0.1 urllib3 1.26.18 wheel 0.41.2 zipp 3.17.0 ```
jamadden commented 10 months ago

pytest is not a supported way to test this project.