Skip to content

Covered lines marked as missing after gevent.joinall. #841

Open
@yury-primer

Description

@yury-primer

Describe the bug
Lines after a call to gevent.joinall() are reported as not covered even though they get run.

To Reproduce

  1. What version of Python are you running?
    3.6.5

  2. What versions of what packages do you have installed? The output of pip freeze is very helpful.

coverage==4.5.4
gevent==1.4.0
greenlet==0.4.15
  1. What code are you running? Give us a specific commit of a specific repo that we can check out.

test_foo.py:

import gevent
import unittest


class TestJoinAll(unittest.TestCase):
    def test_joinall(self):
        def coroutine():
            return 5

        greenlet = gevent.spawn(coroutine)
        gevent.joinall([greenlet])

        result = greenlet.get()  # this line runs, but is not covered
        assert 4 == result       # this line runs, but is not covered


if __name__ == "__main__":
    unittest.main()
  1. What commands did you run?
    coverage run --include=test_foo.py --concurrency=gevent -m test_foo
    The above command should fail. Change the 4 to a 5 to get it to pass.
F
======================================================================
FAIL: test_joinall (__main__.TestJoinAll)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/yury/foo/test_foo.py", line 14, in test_joinall
    assert 4 == result       # this line runs, but is not covered
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (failures=1)

coverage report -m
This will indicate that two lines are not covered.

Name          Stmts   Miss  Cover   Missing
-------------------------------------------
test_foo.py      12      2    83%   13-14

Expected behavior
Lines 13 and 14 clearly ran as they caused the test to fail. They should be reported as covered.

Additional context
Changing gevent.joinall([greenlet]) to greenlet.join() fixes the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingconcurrencyexoticUnusual execution environment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions