Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
ff09ce21
Kaydet (Commit)
ff09ce21
authored
Eyl 24, 2010
tarafından
Alexander Belopolsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #9936: Fixed executable lines' search in the trace module.
üst
5e83da3d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
11 deletions
+32
-11
test_trace.py
Lib/test/test_trace.py
+22
-3
testmod.py
Lib/test/tracedmodules/testmod.py
+6
-0
trace.py
Lib/trace.py
+2
-8
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_trace.py
Dosyayı görüntüle @
ff09ce21
...
...
@@ -188,7 +188,6 @@ class TestLineCounts(unittest.TestCase):
}
self
.
assertEqual
(
tracer
.
results
()
.
counts
,
expected
)
class
TestRunExecCounts
(
unittest
.
TestCase
):
"""A simple sanity test of line-counting, via runctx (exec)"""
def
setUp
(
self
):
...
...
@@ -285,8 +284,9 @@ class TestCoverage(unittest.TestCase):
rmtree
(
TESTFN
)
unlink
(
TESTFN
)
def
_coverage
(
self
,
tracer
):
tracer
.
run
(
'from test import test_pprint; test_pprint.test_main()'
)
def
_coverage
(
self
,
tracer
,
cmd
=
'from test import test_pprint; test_pprint.test_main()'
):
tracer
.
run
(
cmd
)
r
=
tracer
.
results
()
r
.
write_results
(
show_missing
=
True
,
summary
=
True
,
coverdir
=
TESTFN
)
...
...
@@ -313,6 +313,25 @@ class TestCoverage(unittest.TestCase):
files
=
os
.
listdir
(
TESTFN
)
self
.
assertEquals
(
files
,
[])
def
test_issue9936
(
self
):
tracer
=
trace
.
Trace
(
trace
=
0
,
count
=
1
)
modname
=
'test.tracedmodules.testmod'
# Ensure that the module is executed in import
if
modname
in
sys
.
modules
:
del
sys
.
modules
[
modname
]
cmd
=
(
"import test.tracedmodules.testmod as t;"
"t.func(0); t.func2();"
)
with
captured_stdout
()
as
stdout
:
self
.
_coverage
(
tracer
,
cmd
)
stdout
.
seek
(
0
)
stdout
.
readline
()
coverage
=
{}
for
line
in
stdout
:
lines
,
cov
,
module
=
line
.
split
()[:
3
]
coverage
[
module
]
=
(
int
(
lines
),
int
(
cov
[:
-
1
]))
self
.
assertIn
(
modname
,
coverage
)
self
.
assertEqual
(
coverage
[
modname
],
(
5
,
100
))
def
test_main
():
run_unittest
(
__name__
)
...
...
Lib/test/tracedmodules/testmod.py
Dosyayı görüntüle @
ff09ce21
def
func
(
x
):
b
=
x
+
1
return
b
+
2
def
func2
():
"""Test function for issue 9936 """
return
(
1
,
2
,
3
)
Lib/trace.py
Dosyayı görüntüle @
ff09ce21
...
...
@@ -59,7 +59,7 @@ import token
import
tokenize
import
inspect
import
gc
import
dis
import
pickle
def
usage
(
outfile
):
...
...
@@ -376,13 +376,7 @@ def find_lines_from_code(code, strs):
"""Return dict where keys are lines in the line number table."""
linenos
=
{}
line_increments
=
code
.
co_lnotab
[
1
::
2
]
table_length
=
len
(
line_increments
)
docstring
=
False
lineno
=
code
.
co_firstlineno
for
li
in
line_increments
:
lineno
+=
li
for
_
,
lineno
in
dis
.
findlinestarts
(
code
):
if
lineno
not
in
strs
:
linenos
[
lineno
]
=
1
...
...
Misc/NEWS
Dosyayı görüntüle @
ff09ce21
...
...
@@ -68,6 +68,8 @@ Core and Builtins
Library
-------
- Issue #9936: Fixed executable lines' search in the trace module.
- Issue #9790: Rework imports necessary for samefile and sameopenfile
in ntpath.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment