Skip to content

Coverage missing for gevent ThreadPool instances #667

@nedbat

Description

@nedbat

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconcurrencyexoticUnusual execution environment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions