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
e88893cc
Commit
e88893cc
authored
Mar 24, 2011
by
Kurt B. Kaiser
Browse files
Options
Browse Files
Download
Plain Diff
Merge heads
parents
85f3cb45
57648308
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
38 deletions
+28
-38
Lib/test/future_test1.py
Lib/test/future_test1.py
+0
-0
Lib/test/future_test2.py
Lib/test/future_test2.py
+0
-0
Lib/test/regrtest.py
Lib/test/regrtest.py
+22
-7
Lib/test/test_collections.py
Lib/test/test_collections.py
+0
-25
Lib/test/test_future.py
Lib/test/test_future.py
+6
-6
No files found.
Lib/test/
test_future
1.py
→
Lib/test/
future_test
1.py
View file @
e88893cc
File moved
Lib/test/
test_future
2.py
→
Lib/test/
future_test
2.py
View file @
e88893cc
File moved
Lib/test/regrtest.py
View file @
e88893cc
...
...
@@ -42,6 +42,9 @@ Selecting tests
-- specify which special resource intensive tests to run
-M/--memlimit LIMIT
-- run very large memory-consuming tests
--testdir DIR
-- execute test files in the specified directory (instead
of the Python stdlib test suite)
Special runs
...
...
@@ -265,7 +268,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
'use='
,
'threshold='
,
'trace'
,
'coverdir='
,
'nocoverdir'
,
'runleaks'
,
'huntrleaks='
,
'memlimit='
,
'randseed='
,
'multiprocess='
,
'coverage'
,
'slaveargs='
,
'forever'
,
'debug'
,
'start='
,
'nowindows'
,
'header'
])
'start='
,
'nowindows'
,
'header'
,
'testdir='
])
except
getopt
.
error
as
msg
:
usage
(
msg
)
...
...
@@ -315,7 +318,9 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
elif
o
in
(
'-T'
,
'--coverage'
):
trace
=
True
elif
o
in
(
'-D'
,
'--coverdir'
):
coverdir
=
os
.
path
.
join
(
os
.
getcwd
(),
a
)
# CWD is replaced with a temporary dir before calling main(), so we
# need join it with the saved CWD so it goes where the user expects.
coverdir
=
os
.
path
.
join
(
support
.
SAVEDCWD
,
a
)
elif
o
in
(
'-N'
,
'--nocoverdir'
):
coverdir
=
None
elif
o
in
(
'-R'
,
'--huntrleaks'
):
...
...
@@ -393,6 +398,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
print
()
# Force a newline (just in case)
print
(
json
.
dumps
(
result
))
sys
.
exit
(
0
)
elif
o
==
'--testdir'
:
# CWD is replaced with a temporary dir before calling main(), so we
# join it with the saved CWD so it ends up where the user expects.
testdir
=
os
.
path
.
join
(
support
.
SAVEDCWD
,
a
)
else
:
print
((
"No handler for option {}. Please report this as a bug "
"at http://bugs.python.org."
).
format
(
o
),
file
=
sys
.
stderr
)
...
...
@@ -467,7 +476,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
print
(
"== "
,
os
.
getcwd
())
print
(
"Testing with flags:"
,
sys
.
flags
)
alltests
=
findtests
(
testdir
,
stdtests
,
nottests
)
# if testdir is set, then we are not running the python tests suite, so
# don't add default tests to be executed or skipped (pass empty values)
if
testdir
:
alltests
=
findtests
(
testdir
,
list
(),
set
())
else
:
alltests
=
findtests
(
testdir
,
stdtests
,
nottests
)
selected
=
tests
or
args
or
alltests
if
single
:
selected
=
selected
[:
1
]
...
...
@@ -713,6 +728,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
sys.exit(len(bad) > 0 or interrupted)
# small set of tests to determine if we have a basically functioning interpreter
# (i.e. if any of these fail, then anything else is likely to follow)
STDTESTS = [
'test_grammar',
'test_opcodes',
...
...
@@ -725,10 +742,8 @@ STDTESTS = [
'test_doctest2',
]
NOTTESTS = {
'test_future1',
'test_future2',
}
# set of tests that we don't want to be executed when using regrtest
NOTTESTS = set()
def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
"""Return a list of all applicable test modules."""
...
...
Lib/test/test_collections.py
View file @
e88893cc
...
...
@@ -332,37 +332,12 @@ class TestNamedTuple(unittest.TestCase):
# verify that _source can be run through exec()
tmp
=
namedtuple
(
'NTColor'
,
'red green blue'
)
globals
().
pop
(
'NTColor'
,
None
)
# remove artifacts from other tests
self
.
assertNotIn
(
'NTColor'
,
globals
())
exec
(
tmp
.
_source
,
globals
())
self
.
assertIn
(
'NTColor'
,
globals
())
c
=
NTColor
(
10
,
20
,
30
)
self
.
assertEqual
((
c
.
red
,
c
.
green
,
c
.
blue
),
(
10
,
20
,
30
))
self
.
assertEqual
(
NTColor
.
_fields
,
(
'red'
,
'green'
,
'blue'
))
globals
().
pop
(
'NTColor'
,
None
)
# clean-up after this test
self
.
assertNotIn
(
'NTColor'
,
globals
())
def
test_source_importable
(
self
):
tmp
=
namedtuple
(
'Color'
,
'hue sat val'
)
compiled
=
None
source
=
TESTFN
+
'.py'
with
open
(
source
,
'w'
)
as
f
:
print
(
tmp
.
_source
,
file
=
f
)
if
TESTFN
in
sys
.
modules
:
del
sys
.
modules
[
TESTFN
]
try
:
mod
=
__import__
(
TESTFN
)
compiled
=
mod
.
__file__
Color
=
mod
.
Color
c
=
Color
(
10
,
20
,
30
)
self
.
assertEqual
((
c
.
hue
,
c
.
sat
,
c
.
val
),
(
10
,
20
,
30
))
self
.
assertEqual
(
Color
.
_fields
,
(
'hue'
,
'sat'
,
'val'
))
finally
:
forget
(
TESTFN
)
if
compiled
:
unlink
(
compiled
)
unlink
(
source
)
################################################################################
...
...
Lib/test/test_future.py
View file @
e88893cc
...
...
@@ -13,14 +13,14 @@ def get_error_location(msg):
class FutureTest(unittest.TestCase):
def test_future1(self):
support.unload('
test_future
1
')
from test import
test_future
1
self.assertEqual(
test_future
1.result, 6)
support.unload('
future_test
1
')
from test import
future_test
1
self.assertEqual(
future_test
1.result, 6)
def test_future2(self):
support.unload('
test_future
2
')
from test import
test_future
2
self.assertEqual(
test_future
2.result, 6)
support.unload('
future_test
2
')
from test import
future_test
2
self.assertEqual(
future_test
2.result, 6)
def test_future3(self):
support.unload('
test_future3
')
...
...
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