Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9dcbbea8
Commit
9dcbbea8
authored
Apr 27, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out common boilerplate for test_support
parent
c23fb774
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
24 deletions
+14
-24
Lib/test/test_bisect.py
Lib/test/test_bisect.py
+2
-12
Lib/test/test_bool.py
Lib/test/test_bool.py
+1
-3
Lib/test/test_os.py
Lib/test/test_os.py
+5
-9
Lib/test/test_support.py
Lib/test/test_support.py
+6
-0
No files found.
Lib/test/test_bisect.py
View file @
9dcbbea8
...
@@ -192,24 +192,14 @@ a priority queue (example courtesy of Fredrik Lundh):
...
@@ -192,24 +192,14 @@ a priority queue (example courtesy of Fredrik Lundh):
"""
"""
#==============================================================================
def
makeAllTests
():
suite
=
unittest
.
TestSuite
()
for
klass
in
(
TestBisect
,
TestInsort
):
suite
.
addTest
(
unittest
.
makeSuite
(
klass
))
return
suite
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
__test__
=
{
'libreftest'
:
libreftest
}
__test__
=
{
'libreftest'
:
libreftest
}
def
test_main
(
verbose
=
None
):
def
test_main
(
verbose
=
None
):
from
test
import
test_bisect
from
test
import
test_bisect
suite
=
makeAllTests
()
test_support
.
run_classtests
(
TestBisect
,
test_support
.
run_suite
(
suite
)
TestInsort
)
test_support
.
run_doctest
(
test_bisect
,
verbose
)
test_support
.
run_doctest
(
test_bisect
,
verbose
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Lib/test/test_bool.py
View file @
9dcbbea8
...
@@ -331,9 +331,7 @@ class BoolTest(unittest.TestCase):
...
@@ -331,9 +331,7 @@ class BoolTest(unittest.TestCase):
self
.
assertEqual
(
cPickle
.
dumps
(
False
,
True
),
"I00
\
n
."
)
self
.
assertEqual
(
cPickle
.
dumps
(
False
,
True
),
"I00
\
n
."
)
def
test_main
():
def
test_main
():
suite
=
unittest
.
TestSuite
()
test_support
.
run_classtests
(
BoolTest
)
suite
.
addTest
(
unittest
.
makeSuite
(
BoolTest
))
test_support
.
run_suite
(
suite
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_main
()
test_main
()
...
...
Lib/test/test_os.py
View file @
9dcbbea8
...
@@ -9,7 +9,7 @@ import warnings
...
@@ -9,7 +9,7 @@ import warnings
warnings
.
filterwarnings
(
"ignore"
,
"tempnam"
,
RuntimeWarning
,
__name__
)
warnings
.
filterwarnings
(
"ignore"
,
"tempnam"
,
RuntimeWarning
,
__name__
)
warnings
.
filterwarnings
(
"ignore"
,
"tmpnam"
,
RuntimeWarning
,
__name__
)
warnings
.
filterwarnings
(
"ignore"
,
"tmpnam"
,
RuntimeWarning
,
__name__
)
from
test.test_support
import
TESTFN
,
run_
suite
from
test.test_support
import
TESTFN
,
run_
classtests
class
TemporaryFileTests
(
unittest
.
TestCase
):
class
TemporaryFileTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -282,14 +282,10 @@ class WalkTests(unittest.TestCase):
...
@@ -282,14 +282,10 @@ class WalkTests(unittest.TestCase):
os
.
rmdir
(
TESTFN
)
os
.
rmdir
(
TESTFN
)
def
test_main
():
def
test_main
():
suite
=
unittest
.
TestSuite
()
run_classtests
(
TemporaryFileTests
,
for
cls
in
(
TemporaryFileTests
,
StatAttributeTests
,
StatAttributeTests
,
EnvironTests
,
EnvironTests
,
WalkTests
)
WalkTests
,
):
suite
.
addTest
(
unittest
.
makeSuite
(
cls
))
run_suite
(
suite
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_main
()
test_main
()
Lib/test/test_support.py
View file @
9dcbbea8
...
@@ -233,6 +233,12 @@ def run_unittest(testclass):
...
@@ -233,6 +233,12 @@ def run_unittest(testclass):
"""Run tests from a unittest.TestCase-derived class."""
"""Run tests from a unittest.TestCase-derived class."""
run_suite
(
unittest
.
makeSuite
(
testclass
),
testclass
)
run_suite
(
unittest
.
makeSuite
(
testclass
),
testclass
)
def
run_classtests
(
*
classnames
):
suite
=
unittest
.
TestSuite
()
for
cls
in
classnames
:
suite
.
addTest
(
unittest
.
makeSuite
(
cls
))
run_suite
(
suite
)
#=======================================================================
#=======================================================================
# doctest driver.
# doctest driver.
...
...
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