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
30abb3a6
Kaydet (Commit)
30abb3a6
authored
Nis 30, 2012
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#14558: document the module, argv, and testLoader args of unittest.main.
üst
524bc399
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
unittest.rst
Doc/library/unittest.rst
+14
-6
No files found.
Doc/library/unittest.rst
Dosyayı görüntüle @
30abb3a6
...
...
@@ -1784,11 +1784,12 @@ Loading and running tests
stream, descriptions, verbosity
.. function:: main([module[, defaultTest[, argv[, testRunner[, testLoader[, exit[, verbosity[, failfast[, catchbreak[,buffer]]]]]]]]]])
.. function:: main([module[, defaultTest[, argv[, testRunner[, testLoader[, exit[, verbosity[, failfast[, catchbreak[,
buffer]]]]]]]]]])
A command-line program that runs a set of tests; this is primarily for making
test modules conveniently executable. The simplest use for this function is to
include the following line at the end of a test script::
A command-line program that loads a set of tests from *module* and runs them;
this is primarily for making test modules conveniently executable.
The simplest use for this function is to include the following line at the
end of a test script::
if __name__ == '__main__':
unittest.main()
...
...
@@ -1799,10 +1800,17 @@ Loading and running tests
if __name__ == '__main__':
unittest.main(verbosity=2)
The *argv* argument can be a list of options passed to the program, with the
first element being the program name. If not specified or ``None``,
the values of :data:`sys.argv` are used.
The *testRunner* argument can either be a test runner class or an already
created instance of it. By default ``main`` calls :func:`sys.exit` with
an exit code indicating success or failure of the tests run.
The *testLoader* argument has to be a :class:`TestLoader` instance,
and defaults to :data:`defaultTestLoader`.
``main`` supports being used from the interactive interpreter by passing in the
argument ``exit=False``. This displays the result on standard output without
calling :func:`sys.exit`::
...
...
@@ -1810,14 +1818,14 @@ Loading and running tests
>>> from unittest import main
>>> main(module='test_module', exit=False)
The
``failfast``, ``catchbreak`` and ``buffer``
parameters have the same
The
*failfast*, *catchbreak* and *buffer*
parameters have the same
effect as the same-name `command-line options`_.
Calling ``main`` actually returns an instance of the ``TestProgram`` class.
This stores the result of the tests run as the ``result`` attribute.
.. versionchanged:: 2.7
The
``exit``, ``verbosity``, ``failfast``, ``catchbreak`` and ``buffer``
The
*exit*, *verbosity*, *failfast*, *catchbreak* and *buffer*
parameters were added.
...
...
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