FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

trace module cli does not write cover files · Issue #76089 · python/cpython · GitHub

Repository navigation

trace module cli does not write cover files #76089

Description

BPO 31908
Nosy @rhettinger, @abalkin, @berkerpeksag, @serhiy-storchaka, @selik, @ZackerySpytz, @miss-islington
PRs
  • bpo-31908: Fix output of cover files for trace module command-line tool #4205
  • [3.7] bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205) #6666
  • [3.6] bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205) #6667
  • [3.6] bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205) #6668
  • bpo-26818: Add a test to make sure the bug is fixed #8664
  • [3.7] bpo-26818: Add a test to make sure the bug is fixed (GH-8664) #8732
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-10-31.02:55:06.847>
    labels = ['3.7', 'type-bug', 'library']
    title = 'trace module cli does not write cover files'
    updated_at = <Date 2018-08-11.06:28:37.697>
    user = 'https://bugs.python.org/MichaelSelik'

    bugs.python.org fields:

    activity = <Date 2018-08-11.06:28:37.697>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2017-10-31.02:55:06.847>
    creator = 'Michael Selik'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31908
    keywords = ['patch']
    message_count = 13.0
    messages = ['305268', '305269', '305341', '305343', '305347', '305367', '306173', '315980', '315981', '315984', '323058', '323401', '323403']
    nosy_count = 8.0
    nosy_names = ['rhettinger', 'belopolsky', 'berker.peksag', 'serhiy.storchaka', 'selik', 'Michael Selik', 'ZackerySpytz', 'miss-islington']
    pr_nums = ['4205', '6666', '6667', '6668', '8664', '8732']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31908'
    versions = ['Python 3.6', 'Python 3.7']

    Activity

    1. MichaelSelik commented on Oct 31, 2017

      MichaelSelikmannequin
      MannequinAuthor

      The trace module command-line utility doesn't write cover files. I've noticed this issue for some years now. It works fine in Python 2. When using Python 3, no ".cover" files are written, regardless of how "--coverdir" is specified.

      mike on macbook in ~/
      $ echo 'print("hello")' > foo.py
      
      mike on macbook in ~/
      $ python -m trace --count foo.py
      hello
      
      mike on macbook in ~/
      $ ls *.cover
      ls: *.cover: No such file or directory
      

      My apologies if this is a duplicate bug. I searched the tracker and Google for a while, but couldn't find a relevant issue.

    2. rhettinger commented on Oct 31, 2017

      Contributor

      It worked in Python 3.4, but not afterwards.

    3. added
      stdlibStandard Library Python modules in the Lib/ directory
      on Oct 31, 2017
    4. MichaelSelik commented on Oct 31, 2017

      MichaelSelikmannequin
      MannequinAuthor

      The problem appears to be a mistake in commit f026dae

      f026dae

      This made the writing of cover files conditional on show_missing which is the option to mark lines which weren't executed with several angle brackets ">>>>>".

      https://github.com/python/cpython/blob/3.5/Lib/trace.py#L326

      mike on mac in ~/
      $ python -m trace --count foo.py
      hello
      
      mike on mac in ~/
      $ ls *.cover
      ls: *.cover: No such file or directory
      
      mike on mac in ~/
      $ python -m trace --count -m foo.py
      hello
      
      mike on mac in ~/
      $ ls *.cover
      -rw-r--r--  1 mike  staff    22B Oct 31 15:40 foo.cover
      
    5. MichaelSelik commented on Nov 1, 2017

      MichaelSelikmannequin
      MannequinAuthor

      While writing a patch for this, I noticed the lnotab parameter seems nearly unused. It's a dict, but is only used for its keys.

      https://github.com/python/cpython/blob/master/Lib/trace.py#L333

      Further, the choice to count unreached lines only when show_missing was set seems inconsistent.

      https://github.com/python/cpython/blob/master/Lib/trace.py#L335

      https://github.com/python/cpython/blob/master/Lib/trace.py#L280

    6. MichaelSelik commented on Nov 1, 2017

      MichaelSelikmannequin
      MannequinAuthor

      Ok, pull request submitted:
      #4205

    7. berkerpeksag commented on Nov 1, 2017

      Member

      I think the first part of your patch also fixes bpo-26818. Could you adapt the test there and add a test case for the problem in this issue?

    8. selik commented on Nov 13, 2017

      selikmannequin
      Mannequin

      You're referring to something like this:

      + def test_count_and_summary(self):
      + name = TESTFN + '.py'
      + with open(name, 'w') as fd:
      + self.addCleanup(unlink, name)
      + fd.write("""\
      +x = 1
      +y = 2
      +
      +def f():
      + return x + y
      +
      +for i in range(10):
      + f()
      + """)
      + status, stdout, stderr = assert_python_ok('-m', 'trace', '-cs', name)
      + self.assertEqual(status, 0)
      + self.assertIn(b'lines cov% module (path)', stdout)
      + self.assertIn(('6 100%% %s (%s)' % (TESTFN, name)).encode(), stdout)
      +

      ?

    9. serhiy-storchaka commented on May 1, 2018

      Member

      New changeset 47ab154 by Serhiy Storchaka (Michael Selik) in branch 'master':
      bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205)
      47ab154

    10. miss-islington commented on May 1, 2018

      Contributor

      New changeset e4eeb6e by Miss Islington (bot) in branch '3.7':
      bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205)
      e4eeb6e

    11. miss-islington commented on May 1, 2018

      Contributor

      New changeset a607f8b by Miss Islington (bot) in branch '3.6':
      bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205)
      a607f8b

    12. ZackerySpytz commented on Aug 3, 2018

      ZackerySpytzmannequin
      Mannequin

      This change causes test_trace to leave a trace.cover file in the Lib directory (see bpo-34171).

    13. berkerpeksag commented on Aug 11, 2018

      Member

      New changeset c8b0dbc by Berker Peksag in branch 'master':
      bpo-26818: Add a test to make sure the bug is fixed (GH-8664)
      c8b0dbc

    14. berkerpeksag commented on Aug 11, 2018

      Member

      New changeset 8fc21c8 by Berker Peksag (Miss Islington (bot)) in branch '3.7':
      bpo-26818: Add a test to make sure the bug is fixed (GH-8664)
      8fc21c8

    15. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions


        Back | FazBrowse Home | New Git URL