Issue31908
Created on 2017-10-31 02:55 by Michael Selik, last changed 2022-04-11 14:58 by admin.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4205 | merged | selik, 2017-11-01 01:38 | |
| PR 6666 | merged | miss-islington, 2018-05-01 03:48 | |
| PR 6667 | closed | miss-islington, 2018-05-01 03:49 | |
| PR 6668 | merged | miss-islington, 2018-05-01 04:41 | |
| PR 8664 | merged | berker.peksag, 2018-08-03 21:27 | |
| PR 8732 | merged | miss-islington, 2018-08-11 06:16 | |
| Messages (13) | |||
|---|---|---|---|
| msg305268 - (view) | Author: Michael Selik (Michael Selik) | Date: 2017-10-31 02:55 | |
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.
|
|||
| msg305269 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2017-10-31 04:19 | |
It worked in Python 3.4, but not afterwards. |
|||
| msg305341 - (view) | Author: Michael Selik (Michael Selik) | Date: 2017-10-31 22:46 | |
The problem appears to be a mistake in commit f026dae130bf6f9015c4b212f16852ba4a3f3dec https://github.com/python/cpython/commit/f026dae130bf6f9015c4b212f16852ba4a3f3dec 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 |
|||
| msg305343 - (view) | Author: Michael Selik (Michael Selik) | Date: 2017-11-01 01:10 | |
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 |
|||
| msg305347 - (view) | Author: Michael Selik (Michael Selik) | Date: 2017-11-01 01:51 | |
Ok, pull request submitted: https://github.com/python/cpython/pull/4205 |
|||
| msg305367 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2017-11-01 10:50 | |
I think the first part of your patch also fixes issue 26818. Could you adapt the test there and add a test case for the problem in this issue? |
|||
| msg306173 - (view) | Author: Michael Selik (selik) * | Date: 2017-11-13 22:43 | |
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)
+
?
|
|||
| msg315980 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-05-01 03:47 | |
New changeset 47ab15470d72367694d7758004067313ae022f0e by Serhiy Storchaka (Michael Selik) in branch 'master': bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205) https://github.com/python/cpython/commit/47ab15470d72367694d7758004067313ae022f0e |
|||
| msg315981 - (view) | Author: miss-islington (miss-islington) | Date: 2018-05-01 04:06 | |
New changeset e4eeb6eff12947a55df5eabee36e537cadefbbac by Miss Islington (bot) in branch '3.7': bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205) https://github.com/python/cpython/commit/e4eeb6eff12947a55df5eabee36e537cadefbbac |
|||
| msg315984 - (view) | Author: miss-islington (miss-islington) | Date: 2018-05-01 05:03 | |
New changeset a607f8b9982ac95bb59f8f61e0a50fc5ae29dc14 by Miss Islington (bot) in branch '3.6': bpo-31908: Fix output of cover files for trace module command-line tool. (GH-4205) https://github.com/python/cpython/commit/a607f8b9982ac95bb59f8f61e0a50fc5ae29dc14 |
|||
| msg323058 - (view) | Author: Zackery Spytz (ZackerySpytz) * ![]() |
Date: 2018-08-03 14:57 | |
This change causes test_trace to leave a trace.cover file in the Lib directory (see #34171). |
|||
| msg323401 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2018-08-11 06:15 | |
New changeset c8b0dbc4928a1fe4bd5abebd810b6849374c7af3 by Berker Peksag in branch 'master': bpo-26818: Add a test to make sure the bug is fixed (GH-8664) https://github.com/python/cpython/commit/c8b0dbc4928a1fe4bd5abebd810b6849374c7af3 |
|||
| msg323403 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2018-08-11 06:28 | |
New changeset 8fc21c80af73226de875886132e0c32a4ffb32c5 by Berker Peksag (Miss Islington (bot)) in branch '3.7': bpo-26818: Add a test to make sure the bug is fixed (GH-8664) https://github.com/python/cpython/commit/8fc21c80af73226de875886132e0c32a4ffb32c5 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:53 | admin | set | github: 76089 |
| 2018-08-11 06:28:37 | berker.peksag | set | messages: + msg323403 |
| 2018-08-11 06:16:03 | miss-islington | set | pull_requests: + pull_request8219 |
| 2018-08-11 06:15:46 | berker.peksag | set | messages: + msg323401 |
| 2018-08-03 21:27:11 | berker.peksag | set | pull_requests: + pull_request8160 |
| 2018-08-03 14:57:10 | ZackerySpytz | set | nosy:
+ ZackerySpytz messages: + msg323058 |
| 2018-05-01 05:03:31 | miss-islington | set | messages: + msg315984 |
| 2018-05-01 04:41:50 | miss-islington | set | pull_requests: + pull_request6362 |
| 2018-05-01 04:06:03 | miss-islington | set | nosy:
+ miss-islington messages: + msg315981 |
| 2018-05-01 03:49:02 | miss-islington | set | pull_requests: + pull_request6361 |
| 2018-05-01 03:48:09 | miss-islington | set | pull_requests: + pull_request6360 |
| 2018-05-01 03:47:01 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg315980 |
| 2017-11-13 22:43:51 | selik | set | messages: + msg306173 |
| 2017-11-13 22:41:21 | selik | set | nosy:
+ selik |
| 2017-11-01 10:50:25 | berker.peksag | set | nosy:
+ berker.peksag messages:
+ msg305367 |
| 2017-11-01 05:09:27 | rhettinger | set | nosy:
+ belopolsky |
| 2017-11-01 01:51:48 | Michael Selik | set | messages: + msg305347 |
| 2017-11-01 01:38:25 | selik | set | keywords:
+ patch stage: patch review pull_requests: + pull_request4174 |
| 2017-11-01 01:10:39 | Michael Selik | set | messages: + msg305343 |
| 2017-10-31 22:46:10 | Michael Selik | set | messages: + msg305341 |
| 2017-10-31 04:19:24 | rhettinger | set | versions:
+ Python 3.5, Python 3.7 nosy: + rhettinger messages: + msg305269 components: + Library (Lib) |
| 2017-10-31 02:55:06 | Michael Selik | create | |

