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
0fe118b9
Kaydet (Commit)
0fe118b9
authored
Nis 24, 2007
tarafından
Collin Winter
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Convert PyUnit -> unittest.
üst
9fab9f10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
README
Lib/test/README
+10
-11
No files found.
Lib/test/README
Dosyayı görüntüle @
0fe118b9
...
@@ -15,7 +15,7 @@ testing facility provided with Python; any particular test should use only
...
@@ -15,7 +15,7 @@ testing facility provided with Python; any particular test should use only
one of these options. Each option requires writing a test module using the
one of these options. Each option requires writing a test module using the
conventions of the selected option:
conventions of the selected option:
-
PyUni
t_ based tests
-
unittes
t_ based tests
- doctest_ based tests
- doctest_ based tests
- "traditional" Python test modules
- "traditional" Python test modules
...
@@ -28,27 +28,26 @@ your test cases to exercise it more completely. In particular, you will be
...
@@ -28,27 +28,26 @@ your test cases to exercise it more completely. In particular, you will be
able to refer to the C and Python code in the CVS repository when writing
able to refer to the C and Python code in the CVS repository when writing
your regression test cases.
your regression test cases.
.. _PyUnit:
.. _unittest: http://www.python.org/doc/current/lib/module-unittest.html
.. _unittest: http://www.python.org/doc/current/lib/module-unittest.html
.. _doctest: http://www.python.org/doc/current/lib/module-doctest.html
.. _doctest: http://www.python.org/doc/current/lib/module-doctest.html
PyUnit
based tests
unittest-
based tests
------------------
------------------
The
PyUni
t_ framework is based on the ideas of unit testing as espoused
The
unittes
t_ framework is based on the ideas of unit testing as espoused
by Kent Beck and the `Extreme Programming`_ (XP) movement. The specific
by Kent Beck and the `Extreme Programming`_ (XP) movement. The specific
interface provided by the framework is tightly based on the JUnit_
interface provided by the framework is tightly based on the JUnit_
Java implementation of Beck's original SmallTalk test framework. Please
Java implementation of Beck's original SmallTalk test framework. Please
see the documentation of the unittest_ module for detailed information on
see the documentation of the unittest_ module for detailed information on
the interface and general guidelines on writing
PyUnit
based tests.
the interface and general guidelines on writing
unittest-
based tests.
The test_support helper module provides two functions for use by
The test_support helper module provides two functions for use by
PyUnit
based tests in the Python regression testing framework:
unittest-
based tests in the Python regression testing framework:
- ``run_unittest()`` takes a
``unittest.TestCase`` derived class as a
- ``run_unittest()`` takes a
number of ``unittest.TestCase`` derived classes as
parameter
and runs the tests defined in that class
parameter
s and runs the tests defined in those classes.
- ``run_suite()`` takes a populated ``TestSuite`` instance and runs the
- ``run_suite()`` takes a populated ``TestSuite`` instance and runs the
tests
tests
.
``run_suite()`` is preferred because unittest files typically grow multiple
``run_suite()`` is preferred because unittest files typically grow multiple
test classes, and you might as well be prepared.
test classes, and you might as well be prepared.
...
@@ -63,7 +62,7 @@ and the full class name. When there's a problem with a test, the
...
@@ -63,7 +62,7 @@ and the full class name. When there's a problem with a test, the
latter information makes it easier to find the source for the test
latter information makes it easier to find the source for the test
than the docstring.
than the docstring.
All
PyUni
t-based tests in the Python test suite use boilerplate that
All
unittes
t-based tests in the Python test suite use boilerplate that
looks like this (with minor variations)::
looks like this (with minor variations)::
import unittest
import unittest
...
@@ -415,7 +414,7 @@ Some Non-Obvious regrtest Features
...
@@ -415,7 +414,7 @@ Some Non-Obvious regrtest Features
This is rarely required with the "traditional" Python tests, and
This is rarely required with the "traditional" Python tests, and
you shouldn't create a module global with name test_main unless
you shouldn't create a module global with name test_main unless
you're specifically exploiting this gimmick. This usage does
you're specifically exploiting this gimmick. This usage does
prove useful with
PyUni
t-based tests as well, however; defining
prove useful with
unittes
t-based tests as well, however; defining
a ``test_main()`` which is run by regrtest and a script-stub in the
a ``test_main()`` which is run by regrtest and a script-stub in the
test module ("``if __name__ == '__main__': test_main()``") allows
test module ("``if __name__ == '__main__': test_main()``") allows
the test to be used like any other Python test and also work
the test to be used like any other Python test and also work
...
...
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