coveragepy / coveragepy/coveragepy

gevent 1.3.2 on Windows fails

Open
#663 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

concurrency exotic
Dominant language
Python
Stars
3.4k
Forks
525
Avg merge
18h 27m
Merged PRs (30d)
6

Description

See: https://github.com/gevent/gevent/issues/1232

================================== FAILURES ===================================
_________________________ ConcurrencyTest.test_gevent _________________________
self = <tests.test_concurrency.ConcurrencyTest testMethod=test_gevent>
    def test_gevent(self):
        code = (GEVENT + SUM_RANGE_Q + PRINT_SUM_RANGE).format(QLIMIT=self.QLIMIT)
>       self.try_some_code(code, "gevent", gevent)
tests\test_concurrency.py:268: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\test_concurrency.py:248: in try_some_code
    self.assertEqual(data.line_counts()['try_it.py'], lines)
E   AssertionError: 43 != 37
---------------------------- Captured stdout call -----------------------------
499500
    from gevent import monkey
    monkey.patch_thread()
    import threading
    import gevent.queue as queue
    
    # Above this will be imports defining queue and threading.
    class Producer(threading.Thread):
        def __init__(self, limit, q):
            threading.Thread.__init__(self)
            self.limit = limit
            self.q = q
        def run(self):
            for i in range(self.limit):
                self.q.put(i)
            self.q.put(None)
    class Consumer(threading.Thread):
        def __init__(self, q, qresult):
            threading.Thread.__init__(self)
            self.q = q
            self.qresult = qresult
        def run(self):
            sum = 0
            while True:
                i = self.q.get()
                if i is None:
                    break
                sum += i
            self.qresult.put(sum)
    def sum_range(limit):
        q = queue.Queue()
        qresult = queue.Queue()
        c = Consumer(q, qresult)
        p = Producer(limit, q)
        c.start()
        p.start()
        p.join()
        c.join()
        return qresult.get()
    # Below this will be something using sum_range.
    
    print(sum_range(1000))
    
43: [2, 3, 4, 5, 9, 10, 15, 20, 21, 26, 35, 49, 36, 37, 38, 22, 23, 24, 39, 11, 12, 13, 40, 27, 28, 29, 472, 477, 431, 432, 433, 434, 41, 16, 17, 18, 43, 44, 30, 32, 31, 33, 45]
   
 X     from gevent import monkey
 X     monkey.patch_thread()
 X     import threading
 X     import gevent.queue as queue
       
       # Above this will be imports defining queue and threading.
   
 X     class Producer(threading.Thread):
 X         def __init__(self, limit, q):
 X             threading.Thread.__init__(self)
 X             self.limit = limit
 X             self.q = q
   
 X         def run(self):
 X             for i in range(self.limit):
 X                 self.q.put(i)
 X             self.q.put(None)
   
 X     class Consumer(threading.Thread):
 X         def __init__(self, q, qresult):
 X             threading.Thread.__init__(self)
 X             self.q = q
 X             self.qresult = qresult
   
 X         def run(self):
 X             sum = 0
 X             while True:
 X                 i = self.q.get()
 X                 if i is None:
 X                     break
 X                 sum += i
 X             self.qresult.put(sum)
   
 X     def sum_range(limit):
 X         q = queue.Queue()
 X         qresult = queue.Queue()
 X         c = Consumer(q, qresult)
 X         p = Producer(limit, q)
 X         c.start()
 X         p.start()
   
 X         p.join()
 X         c.join()
 X         return qresult.get()
   
       # Below this will be something using sum_range.
       
 X     print(sum_range(1000))
       
1 failed, 787 passed, 5 skipped in 133.48 seconds

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/test_concurrency.py, especially ConcurrencyTest.test_gevent and try_some_code, and compare the Windows failure with the referenced gevent issue. Reproduce the test on Windows, trace why the reported line counts differ, and verify that the concurrency test passes without regressing the existing suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.