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
a67d78e5
Kaydet (Commit)
a67d78e5
authored
Haz 24, 2016
tarafından
Berker Peksag
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #18300: Merge from 3.5
üst
69da9c43
e495646a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
script_helper.py
Lib/test/support/script_helper.py
+4
-0
test_doctest.py
Lib/test/test_doctest.py
+9
-15
No files found.
Lib/test/support/script_helper.py
Dosyayı görüntüle @
a67d78e5
...
...
@@ -73,6 +73,10 @@ def run_python_until_end(*args, **env_vars):
# Need to preserve the original environment, for in-place testing of
# shared library builds.
env
=
os
.
environ
.
copy
()
# set TERM='' unless the TERM environment variable is passed explicitly
# see issues #11390 and #18300
if
'TERM'
not
in
env_vars
:
env
[
'TERM'
]
=
''
# But a special flag that can be set to override -- in this case, the
# caller is responsible to pass the full environment.
if
env_vars
.
pop
(
'__cleanenv'
,
None
):
...
...
Lib/test/test_doctest.py
Dosyayı görüntüle @
a67d78e5
...
...
@@ -2718,12 +2718,6 @@ output into something we can doctest against:
>>> def normalize(s):
... return '\n'.join(s.decode().splitlines())
Note: we also pass TERM='' to all the assert_python calls to avoid a bug
in the readline library that is triggered in these tests because we are
running them in a new python process. See:
http://lists.gnu.org/archive/html/bug-readline/2013-06/msg00000.html
With those preliminaries out of the way, we'll start with a file with two
simple tests and no errors. We'll run both the unadorned doctest command, and
the verbose version, and then check the output:
...
...
@@ -2740,9 +2734,9 @@ the verbose version, and then check the output:
... _ = f.write('\n')
... _ = f.write('And that is it.\n')
... rc1, out1, err1 = script_helper.assert_python_ok(
... '-m', 'doctest', fn
, TERM=''
)
... '-m', 'doctest', fn)
... rc2, out2, err2 = script_helper.assert_python_ok(
... '-m', 'doctest', '-v', fn
, TERM=''
)
... '-m', 'doctest', '-v', fn)
With no arguments and passing tests, we should get no output:
...
...
@@ -2804,17 +2798,17 @@ text files).
... _ = f.write("\n")
... _ = f.write(' \"\"\"\n')
... rc1, out1, err1 = script_helper.assert_python_failure(
... '-m', 'doctest', fn, fn2
, TERM=''
)
... '-m', 'doctest', fn, fn2)
... rc2, out2, err2 = script_helper.assert_python_ok(
... '-m', 'doctest', '-o', 'ELLIPSIS', fn
, TERM=''
)
... '-m', 'doctest', '-o', 'ELLIPSIS', fn)
... rc3, out3, err3 = script_helper.assert_python_ok(
... '-m', 'doctest', '-o', 'ELLIPSIS',
... '-o', 'NORMALIZE_WHITESPACE', fn, fn2
, TERM=''
)
... '-o', 'NORMALIZE_WHITESPACE', fn, fn2)
... rc4, out4, err4 = script_helper.assert_python_failure(
... '-m', 'doctest', '-f', fn, fn2
, TERM=''
)
... '-m', 'doctest', '-f', fn, fn2)
... rc5, out5, err5 = script_helper.assert_python_ok(
... '-m', 'doctest', '-v', '-o', 'ELLIPSIS',
... '-o', 'NORMALIZE_WHITESPACE', fn, fn2
, TERM=''
)
... '-o', 'NORMALIZE_WHITESPACE', fn, fn2)
Our first test run will show the errors from the first file (doctest stops if a
file has errors). Note that doctest test-run error output appears on stdout,
...
...
@@ -2920,7 +2914,7 @@ We should also check some typical error cases.
Invalid file name:
>>> rc, out, err = script_helper.assert_python_failure(
... '-m', 'doctest', 'nosuchfile'
, TERM=''
)
... '-m', 'doctest', 'nosuchfile')
>>> rc, out
(1, b'')
>>> print(normalize(err)) # doctest: +ELLIPSIS
...
...
@@ -2931,7 +2925,7 @@ Invalid file name:
Invalid doctest option:
>>> rc, out, err = script_helper.assert_python_failure(
... '-m', 'doctest', '-o', 'nosuchoption'
, TERM=''
)
... '-m', 'doctest', '-o', 'nosuchoption')
>>> rc, out
(2, b'')
>>> print(normalize(err)) # doctest: +ELLIPSIS
...
...
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