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

Thread.run() isn't measured #85

Closed
nedbat opened this issue Aug 25, 2010 · 3 comments
Closed

Thread.run() isn't measured #85

nedbat opened this issue Aug 25, 2010 · 3 comments
Labels
bug Something isn't working

Comments

@nedbat
Copy link
Owner

nedbat commented Aug 25, 2010

In this code:

import Queue
import threading
import unittest

class TestThread(threading.Thread):
    def __init__(self, started_queue, stopping_queue):
        threading.Thread.__init__(self)
        self._started_queue = started_queue
        self._stopping_queue = stopping_queue

    def run(self):
        print "starting thread"
        self.fooey()
        self._started_queue.put('')
        msg = self._stopping_queue.get()
        print "exiting thread"

    def fooey(self):
        print "fooey"
        self.booey()
        print "fooey out:"

    def booey(self):
        print "booey"

class ThreadTest(unittest.TestCase):
    def test_threads(self):
        starting_queue = Queue.Queue()
        stopping_queue = Queue.Queue()
        thd = TestThread(starting_queue, stopping_queue)
        stopping_queue.put('')
        thd.start()
        starting_queue.get()
        thd.join()
        self.assertTrue(True)

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

run() is marked as not covered, but fooey() and booey() are. What's up with that?


@nedbat
Copy link
Owner Author

nedbat commented Aug 25, 2010

Original comment by Anonymous


Yes, same bug here, with coverage 3.4b1 and python 2.6.5 or 3.1.2.

Here is an example : http://img153.imageshack.us/img153/2401/plop2.png

@nedbat
Copy link
Owner Author

nedbat commented Aug 26, 2010

Fixed in <<changeset 39a76e1520aa (bb)>>.

@nedbat
Copy link
Owner Author

nedbat commented Aug 26, 2010

Original comment by Anonymous


Thank you !

@nedbat nedbat closed this as completed Aug 26, 2010
@nedbat nedbat added major bug Something isn't working labels Jun 23, 2018
agronholm pushed a commit to agronholm/coveragepy that referenced this issue Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant