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
ff432e6f
Kaydet (Commit)
ff432e6f
authored
Mar 06, 2007
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
üst
72363031
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
2 deletions
+45
-2
libdoctest.tex
Doc/lib/libdoctest.tex
+25
-0
doctest.py
Lib/doctest.py
+17
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/lib/libdoctest.tex
Dosyayı görüntüle @
ff432e6f
...
@@ -201,6 +201,19 @@ prohibit it by passing \code{verbose=False}. In either of those cases,
...
@@ -201,6 +201,19 @@ prohibit it by passing \code{verbose=False}. In either of those cases,
\code
{
sys.argv
}
is not examined by
\function
{
testmod()
}
(so passing
\code
{
sys.argv
}
is not examined by
\function
{
testmod()
}
(so passing
\programopt
{
-v
}
or not has no effect).
\programopt
{
-v
}
or not has no effect).
Since Python 2.6, there is also a command line shortcut for running
\function
{
testmod()
}
. You can instruct the Python interpreter to run
the doctest module directly from the standard library and pass the module
name(s) on the command line:
\begin{verbatim}
python -m doctest -v example.py
\end{verbatim}
This will import
\file
{
example.py
}
as a standalone module and run
\function
{
testmod()
}
on it. Note that this may not work correctly if the
file is part of a package and imports other submodules from that package.
For more information on
\function
{
testmod()
}
, see
For more information on
\function
{
testmod()
}
, see
section~
\ref
{
doctest-basic-api
}
.
section~
\ref
{
doctest-basic-api
}
.
...
@@ -267,6 +280,18 @@ Like \function{testmod()}, \function{testfile()}'s verbosity can be
...
@@ -267,6 +280,18 @@ Like \function{testmod()}, \function{testfile()}'s verbosity can be
set with the
\programopt
{
-v
}
command-line switch or with the optional
set with the
\programopt
{
-v
}
command-line switch or with the optional
keyword argument
\var
{
verbose
}
.
keyword argument
\var
{
verbose
}
.
Since Python 2.6, there is also a command line shortcut for running
\function
{
testfile()
}
. You can instruct the Python interpreter to run
the doctest module directly from the standard library and pass the file
name(s) on the command line:
\begin{verbatim}
python -m doctest -v example.txt
\end{verbatim}
Because the file name does not end with
\file
{
.py
}
,
\module
{
doctest
}
infers
that it must be run with
\function
{
testfile()
}
, not
\function
{
testmod()
}
.
For more information on
\function
{
testfile()
}
, see
For more information on
\function
{
testfile()
}
, see
section~
\ref
{
doctest-basic-api
}
.
section~
\ref
{
doctest-basic-api
}
.
...
...
Lib/doctest.py
Dosyayı görüntüle @
ff432e6f
...
@@ -2630,8 +2630,23 @@ __test__ = {"_TestClass": _TestClass,
...
@@ -2630,8 +2630,23 @@ __test__ = {"_TestClass": _TestClass,
}
}
def
_test
():
def
_test
():
r
=
unittest
.
TextTestRunner
()
testfiles
=
[
arg
for
arg
in
sys
.
argv
[
1
:]
if
arg
and
arg
[
0
]
!=
'-'
]
r
.
run
(
DocTestSuite
())
if
len
(
testfiles
)
>
0
:
for
filename
in
testfiles
:
if
filename
.
endswith
(
".py"
):
# This is a module -- insert its dir into sys.path and try to
# import it. If it is part of a package, that possibly won't work
# because of package imports.
dirname
,
filename
=
os
.
path
.
split
(
filename
)
sys
.
path
.
insert
(
0
,
dirname
)
m
=
__import__
(
filename
[:
-
3
])
del
sys
.
path
[
0
]
testmod
(
m
)
else
:
testfile
(
filename
,
module_relative
=
False
)
else
:
r
=
unittest
.
TextTestRunner
()
r
.
run
(
DocTestSuite
())
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
_test
()
_test
()
Misc/NEWS
Dosyayı görüntüle @
ff432e6f
...
@@ -141,6 +141,9 @@ Core and builtins
...
@@ -141,6 +141,9 @@ Core and builtins
Library
Library
-------
-------
- Patch #1663234: you can now run doctest on test files and modules
using "python -m doctest [-v] filename ...".
- Patch #1121142: Implement ZipFile.open.
- Patch #1121142: Implement ZipFile.open.
- Taught setup.py how to locate Berkeley DB on Macs using MacPorts.
- Taught setup.py how to locate Berkeley DB on Macs using MacPorts.
...
...
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