Skip to content
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

Coverage missing for gevent ThreadPool instances #667

Open
nedbat opened this issue Jun 20, 2018 · 0 comments
Open

Coverage missing for gevent ThreadPool instances #667

nedbat opened this issue Jun 20, 2018 · 0 comments
Labels
bug Something isn't working concurrency exotic Unusual execution environment

Comments

@nedbat
Copy link
Owner

nedbat commented Jun 20, 2018

Originally reported by David Martin (Bitbucket: frostedcheerios, GitHub: Unknown)


The following test file reproduces the bug:

#!python

from gevent import monkey; monkey.patch_all()
from gevent.threadpool import ThreadPool
import unittest

class ThreadPoolTests(unittest.TestCase):
    def executor(self):
        print('I ran in a real thread!')
        return 123

    def test_threadpool(self):
        pool = ThreadPool(10)
        print(pool.spawn(self.executor).get())
        pool.kill()

if __name__ == '__main__':
    unittest.main()

Running that file gives the following results:

$ coverage run --concurrency=gevent test_threadpool.py && coverage report -m
I ran in a real thread!
123
.
----------------------------------------------------------------------
Ran 1 test in 0.003s

OK
Name                 Stmts   Miss  Cover   Missing
--------------------------------------------------
test_threadpool.py      13      2    85%   7-8

I'm using the following python, gevent and coverage versions:

$ coverage --version
Coverage.py, version 4.5.1 with C extension
Documentation at https://coverage.readthedocs.io
$ python --version
Python 3.6.5 :: Anaconda, Inc.
$ python -c "import gevent; print(gevent.__version__)"
1.3.3

@nedbat nedbat added major bug Something isn't working report labels Jun 23, 2018
@nedbat nedbat removed the 4.5 label Aug 17, 2018
@nedbat nedbat added exotic Unusual execution environment and removed bug Something isn't working major report labels Jan 15, 2020
@nedbat nedbat added bug Something isn't working concurrency labels Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working concurrency exotic Unusual execution environment
Projects
None yet
Development

No branches or pull requests

1 participant