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
f7f54759
Kaydet (Commit)
f7f54759
authored
Tem 15, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use test.script_helper in test_pydoc
üst
a6e81a23
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
test_pydoc.py
Lib/test/test_pydoc.py
+13
-11
No files found.
Lib/test/test_pydoc.py
Dosyayı görüntüle @
f7f54759
...
@@ -15,11 +15,12 @@ import textwrap
...
@@ -15,11 +15,12 @@ import textwrap
from
io
import
StringIO
from
io
import
StringIO
from
collections
import
namedtuple
from
collections
import
namedtuple
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
test.script_helper
import
assert_python_ok
from
test.support
import
(
from
test.support
import
(
TESTFN
,
forget
,
rmtree
,
EnvironmentVarGuard
,
TESTFN
,
forget
,
rmtree
,
EnvironmentVarGuard
,
reap_children
,
reap_threads
,
captured_output
,
captured_stdout
,
unlink
reap_children
,
reap_threads
,
captured_output
,
captured_stdout
,
unlink
)
)
from
test
import
pydoc_mod
from
test
import
pydoc_mod
try
:
try
:
...
@@ -201,14 +202,14 @@ missing_pattern = "no Python documentation found for '%s'"
...
@@ -201,14 +202,14 @@ missing_pattern = "no Python documentation found for '%s'"
# output pattern for module with bad imports
# output pattern for module with bad imports
badimport_pattern
=
"problem in
%
s - ImportError: No module named
%
s"
badimport_pattern
=
"problem in
%
s - ImportError: No module named
%
s"
def
run_pydoc
(
module_name
,
*
args
):
def
run_pydoc
(
module_name
,
*
args
,
**
env
):
"""
"""
Runs pydoc on the specified module. Returns the stripped
Runs pydoc on the specified module. Returns the stripped
output of pydoc.
output of pydoc.
"""
"""
cmd
=
[
sys
.
executable
,
pydoc
.
__file__
,
" "
.
join
(
args
),
module_name
]
args
=
args
+
(
module_name
,)
output
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
)
.
communicate
()[
0
]
rc
,
out
,
err
=
assert_python_ok
(
pydoc
.
__file__
,
*
args
,
**
env
)
return
out
put
.
strip
()
return
out
.
strip
()
def
get_pydoc_html
(
module
):
def
get_pydoc_html
(
module
):
"Returns pydoc generated output as html"
"Returns pydoc generated output as html"
...
@@ -307,19 +308,20 @@ class PydocDocTest(unittest.TestCase):
...
@@ -307,19 +308,20 @@ class PydocDocTest(unittest.TestCase):
def
newdirinpath
(
dir
):
def
newdirinpath
(
dir
):
os
.
mkdir
(
dir
)
os
.
mkdir
(
dir
)
sys
.
path
.
insert
(
0
,
dir
)
sys
.
path
.
insert
(
0
,
dir
)
yield
try
:
sys
.
path
.
pop
(
0
)
yield
rmtree
(
dir
)
finally
:
sys
.
path
.
pop
(
0
)
rmtree
(
dir
)
with
newdirinpath
(
TESTFN
),
EnvironmentVarGuard
()
as
env
:
with
newdirinpath
(
TESTFN
):
env
[
'PYTHONPATH'
]
=
TESTFN
fullmodname
=
os
.
path
.
join
(
TESTFN
,
modname
)
fullmodname
=
os
.
path
.
join
(
TESTFN
,
modname
)
sourcefn
=
fullmodname
+
os
.
extsep
+
"py"
sourcefn
=
fullmodname
+
os
.
extsep
+
"py"
for
importstring
,
expectedinmsg
in
testpairs
:
for
importstring
,
expectedinmsg
in
testpairs
:
with
open
(
sourcefn
,
'w'
)
as
f
:
with
open
(
sourcefn
,
'w'
)
as
f
:
f
.
write
(
"import {}
\n
"
.
format
(
importstring
))
f
.
write
(
"import {}
\n
"
.
format
(
importstring
))
try
:
try
:
result
=
run_pydoc
(
modname
)
.
decode
(
"ascii"
)
result
=
run_pydoc
(
modname
,
PYTHONPATH
=
TESTFN
)
.
decode
(
"ascii"
)
finally
:
finally
:
forget
(
modname
)
forget
(
modname
)
expected
=
badimport_pattern
%
(
modname
,
expectedinmsg
)
expected
=
badimport_pattern
%
(
modname
,
expectedinmsg
)
...
...
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