Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6250815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:29:54+00:00 2026-05-24T13:29:54+00:00

I should know the answer to this, but I don’t: if you try to

  • 0

I should know the answer to this, but I don’t: if you try to measure the coverage of a Django project like this:

coverage run manage.py runserver 

you get coverage measurement that misses all of your actual code. Something early on in the process is stopping the measurement, or all the real work happens in a new context that doesn’t get measured at all.

Can someone point me to the specific point in the process where the measurement breaks down, so that I can try to fix coverage.py so that it will measure it properly the way people expect?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:29:55+00:00Added an answer on May 24, 2026 at 1:29 pm

    Do you get the same problem if you run as follows?

    coverage run manage.py runserver --noreload
    

    Without --noreload, another process is started behind the scenes. One process runs the server, the other looks for code changes and restarts the server when changes are made. The chances are, you’re doing the coverage run on the monitoring process rather than the serving process.

    Look at django/core/management/commands/runserver.py and django/utils/autoreload.py.

    Update: I ran the coverage command, then used ps and lsof to look at what was happening. Here’s what I observed:

    ps output:
    
    UID        PID  PPID  C STIME TTY          TIME CMD
    
    vinay    12081  2098  0 16:37 pts/0    00:00:00 /home/vinay/.virtualenvs/watfest/bin/python /home/vinay/.virtualenvs/watfest/bin/coverage run manage.py runserver
    vinay    12082 12081  2 16:37 pts/0    00:00:01 /home/vinay/.virtualenvs/watfest/bin/python manage.py runserver
    
    lsof output:
    
    python    12082      vinay    5u     IPv4      48294      0t0        TCP localhost:8000 (LISTEN)
    

    IOW, even before any reloading there are two processes, and the one listening on the TCP port is not the one which coverage is running on.

    Here’s what I see with --noreload:

    ps output:
    
    UID        PID  PPID  C STIME TTY          TIME CMD
    
    vinay    12140  2098  5 16:44 pts/0    00:00:00 /home/vinay/.virtualenvs/watfest/bin/python /home/vinay/.virtualenvs/watfest/bin/coverage run manage.py runserver --noreload
    
    lsof output:
    
    coverage  12140      vinay    4u     IPv4      51995      0t0        TCP localhost:8000 (LISTEN)
    

    So it’s not obvious why coverage wouldn’t work in the --noreload case. In my very brief test with --noreload, I got coverage of my view code, as shown by the following extract:

    festival/__init__   8      7    13%
    manage              9      4    56%
    settings           33      1    97%
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like I should know the answer to this, but I don't. What
This may seem like a dumb question, but still I don't know the answer.
This is something that I'm sure I should know the answer to, but either
This is one of those I probably should know this, but I don't questions.
I know this should be fairly simple but I don't get it anyhow. I've
This question may look to be very simple but i don't know the answer.
This is the kind of thing I feel I should already know, but don't...
This should be an easy question hopefully but as a rookie I don't know
I should know this by now, but I don't, and for some reason, I
I know this shouldn't be that hard, but I couldn't find the answer on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.