GithubHelp home page GithubHelp logo

Comments (14)

carltongibson avatar carltongibson commented on June 29, 2024 1

Ok, well I can't see anything in obvious... there's a lot going on in the repo so I guess trying to reduce it would be the next phase.

I can see if I can find it next time I'm looking this area.

from channels.

carltongibson avatar carltongibson commented on June 29, 2024

Thanks for the report. I'm not immediately sure what the problem is. Have you explored coverage's concurrency option?

from channels.

kierangillblueberry avatar kierangillblueberry commented on June 29, 2024

I have. It wasn't clear to me which Daphne used so I tried every concurrency option in their docs. I also adding coverage directly to sitecustomize.py as recommended in the docs but did not make any headway.

There are more details in the reproduction's README.md.

from channels.

carltongibson avatar carltongibson commented on June 29, 2024

I'd imagine you'd need a multi-value like multiprocessing,thread 🤔

from channels.

kierangillblueberry avatar kierangillblueberry commented on June 29, 2024

I just tried every combination of the concurrency options available to me:

multiprocessing,greenlet,thread
multiprocessing,greenlet
multiprocessing,thread
greenlet,multiprocessing
greenlet,thread
thread,multiprocessing
thread,greenlet

I am still unable to collect coverage. gevent and eventlet weren't dependencies of anything I am using so I didn't try them.

from channels.

kierangillblueberry avatar kierangillblueberry commented on June 29, 2024

@carltongibson I've created a smaller reproduction here: https://github.com/kierangillblueberry/code-coverage-ChannelsLiveServerTestCase_small

from channels.

carltongibson avatar carltongibson commented on June 29, 2024

Thanks @kierangillblueberry 👀

from channels.

kierangillblueberry avatar kierangillblueberry commented on June 29, 2024

Hey @carltongibson, following up on this. I can also take a stab at this fix but I'm not sure where to start. Any pointers would be helpful! Also happy to hop on a call if you think it'd be helpful.

from channels.

carltongibson avatar carltongibson commented on June 29, 2024

Hi @kierangillblueberry, I haven't had a chance to sit down with it to be honest. First pass would be to see if we can pick down exactly what's happening.

from channels.

carltongibson avatar carltongibson commented on June 29, 2024

parallel = True

Q: does coverage work running with just a single process (I guess yes)?

from channels.

johanneswilm avatar johanneswilm commented on June 29, 2024

@carltongibson @kierangillblueberry Did you make any headway with this?

I am running into the same issue. switching from django/tornado to django-channels decreases the coverage by a lot as coverage no longer can pick up the correct percentage [1]. I used multiprocessing,thread already when running with tornado.

[1] fiduswriter/fiduswriter#1282 (comment)

from channels.

carltongibson avatar carltongibson commented on June 29, 2024

@johanneswilm No, not yet. There are a couple of related issues with the live server test case. It needs someone to sit down with it, and really work out what's going on. (I've been, and am, busy elsewhere and haven't had that time yet.)

from channels.

johanneswilm avatar johanneswilm commented on June 29, 2024

@carltongibson @kierangillblueberry I spent around a day adding print statements various places in my virtual environment... and it looks to me like I have gotten it to work. What was needed was to update coverage to a recent version (7.4.4) and then to enable the sigterm coverage option. ChannelLiveServerTestCase creates a separate daphne process for each test. LiveServerTestCase just creates a single process for an entire test class. I don't know why there is a difference (it creates other problems for me), but at the end of the process, both test classes call the terminate() method on the process, which is equivalent to issuing a sigterm on the process. I have not looked into why this isn't an issue for LiveServerTestCase as it also terminates the process after running tearDownClass(), but in the case of ChannelLiveServerTestCase this was what was lacking in order to make each process write down its findings to disk.

@kierangillblueberry BTW - you don't need a PostgreSQL db for ChannelLiveServerTestCase - you can just a disk-writen sqlite db instead.

I have put it all together in this PR: kierangillblueberry/code-coverage-ChannelsLiveServerTestCase_small#1

I assume that the two of you will figure out if any changes are needed either here or in coverage. At the very least I would document this behavior to not have others waste time on this.

from channels.

carltongibson avatar carltongibson commented on June 29, 2024

@johanneswilm Good digging. Yes, that makes sense. At the least a docs section about collecting coverage here would help.

(I need to dig in a bit more to think about whether there's anything to change.)

from channels.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.