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
b2ad1c8b
Kaydet (Commit)
b2ad1c8b
authored
Eyl 28, 2001
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Reflect recent refinements of the regression testing framework.
üst
e296cede
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
9 deletions
+33
-9
README
Lib/test/README
+33
-9
No files found.
Lib/test/README
Dosyayı görüntüle @
b2ad1c8b
...
@@ -36,12 +36,32 @@ Java implementation of Beck's original SmallTalk test framework. Please
...
@@ -36,12 +36,32 @@ 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 PyUnit based tests.
The test_support helper module provides a
single function
for use by
The test_support helper module provides a
two functions
for use by
PyUnit based tests in the Python regression testing framework:
PyUnit based tests in the Python regression testing framework:
run_unittest() takes a unittest.TestCase derived class as a parameter
run_unittest() takes a unittest.TestCase derived class as a parameter
and runs the tests defined in that class. All test methods in the
and runs the tests defined in that class, and run_suite() takes a
Python regression framework have names that start with "test_" and use
populated TestSuite instance and runs the tests.. All test methods in
lower-case names with words separated with underscores.
the Python regression framework have names that start with "test_" and
use lower-case names with words separated with underscores.
All PyUnit-based tests in the Python test suite use boilerplate that
looks like this:
import unittest
import test_support
class MyTestCase(unittest.TestCase):
# define test methods here...
def test_main():
test_support.run_unittest(MyTestCase)
if __name__ == "__main__":
test_main()
This has the advantage that it allows the unittest module to be used
as a script to run individual tests as well as working well with the
regrtest framework.
doctest based tests
doctest based tests
...
@@ -341,8 +361,12 @@ Some Non-Obvious regrtest Features
...
@@ -341,8 +361,12 @@ Some Non-Obvious regrtest Features
as a module. Most tests run to completion as a side-effect of
as a module. Most tests run to completion as a side-effect of
getting imported. After importing test_spam, regrtest also executes
getting imported. After importing test_spam, regrtest also executes
test_spam.test_main(), if test_spam has a "test_main" attribute.
test_spam.test_main(), if test_spam has a "test_main" attribute.
This is rarely needed, and you shouldn't create a module global
This is rarely required with the "traditional" Python tests, and
with name test_main unless you're specifically exploiting this
you shouldn't create a module global with name test_main unless
gimmick. In such cases, please put a comment saying so near your
you're specifically exploiting this gimmick. This usage does
def test_main, because this feature is so rarely used it's not
prove useful with PyUnit-based tests as well, however; defining
obvious when reading the test code.
a test_main() which is run by regrtest and a script-stub in the
test module ("if __name__ == '__main__': test_main()") allows
the test to be used like any other Python test and also work
with the unittest.py-as-a-script approach, allowing a developer
to run specific tests from the command line.
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