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
f9596181
Commit
f9596181
authored
Mar 02, 2012
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #14158: improved resilience to test files left behind.
parent
4d2bfb5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
Lib/test/regrtest.py
Lib/test/regrtest.py
+22
-5
Lib/test/test_base64.py
Lib/test/test_base64.py
+5
-0
Lib/test/test_mailbox.py
Lib/test/test_mailbox.py
+6
-6
No files found.
Lib/test/regrtest.py
View file @
f9596181
...
@@ -677,10 +677,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
...
@@ -677,10 +677,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
if bad:
if bad:
print(count(len(bad), "
test
"), "
failed
:
")
print(count(len(bad), "
test
"), "
failed
:
")
printlist(bad)
printlist(bad)
if environment_changed:
if environment_changed:
print("
{}
altered
the
execution
environment
:
".format(
print("
{}
altered
the
execution
environment
:
".format(
count(len(environment_changed), "
test
")))
count(len(environment_changed), "
test
")))
printlist(environment_changed)
printlist(environment_changed)
if skipped and not quiet:
if skipped and not quiet:
print(count(len(skipped), "
test
"), "
skipped
:
")
print(count(len(skipped), "
test
"), "
skipped
:
")
printlist(skipped)
printlist(skipped)
...
@@ -890,7 +890,9 @@ class saved_test_environment:
...
@@ -890,7 +890,9 @@ class saved_test_environment:
'logging._handlers', 'logging._handlerList',
'logging._handlers', 'logging._handlerList',
'shutil.archive_formats', 'shutil.unpack_formats',
'shutil.archive_formats', 'shutil.unpack_formats',
'sys.warnoptions', 'threading._dangling',
'sys.warnoptions', 'threading._dangling',
'multiprocessing.process._dangling')
'multiprocessing.process._dangling',
'support.TESTFN',
)
def get_sys_argv(self):
def get_sys_argv(self):
return id(sys.argv), sys.argv, sys.argv[:]
return id(sys.argv), sys.argv, sys.argv[:]
...
@@ -1020,6 +1022,21 @@ class saved_test_environment:
...
@@ -1020,6 +1022,21 @@ class saved_test_environment:
multiprocessing.process._dangling.clear()
multiprocessing.process._dangling.clear()
multiprocessing.process._dangling.update(saved)
multiprocessing.process._dangling.update(saved)
def get_support_TESTFN(self):
if os.path.isfile(support.TESTFN):
result = 'f'
elif os.path.isdir(support.TESTFN):
result = 'd'
else:
result = None
return result
def restore_support_TESTFN(self, saved_value):
if saved_value is None:
if os.path.isfile(support.TESTFN):
os.unlink(support.TESTFN)
elif os.path.isdir(support.TESTFN):
shutil.rmtree(support.TESTFN)
def resource_info(self):
def resource_info(self):
for name in self.resources:
for name in self.resources:
method_suffix = name.replace('.', '_')
method_suffix = name.replace('.', '_')
...
...
Lib/test/test_base64.py
View file @
f9596181
...
@@ -2,6 +2,7 @@ import unittest
...
@@ -2,6 +2,7 @@ import unittest
from
test
import
support
from
test
import
support
import
base64
import
base64
import
binascii
import
binascii
import
os
import
sys
import
sys
import
subprocess
import
subprocess
...
@@ -227,6 +228,10 @@ class BaseXYTestCase(unittest.TestCase):
...
@@ -227,6 +228,10 @@ class BaseXYTestCase(unittest.TestCase):
class
TestMain
(
unittest
.
TestCase
):
class
TestMain
(
unittest
.
TestCase
):
def
tearDown
(
self
):
if
os
.
path
.
exists
(
support
.
TESTFN
):
os
.
unlink
(
support
.
TESTFN
)
def
get_output
(
self
,
*
args
,
**
options
):
def
get_output
(
self
,
*
args
,
**
options
):
args
=
(
sys
.
executable
,
'-m'
,
'base64'
)
+
args
args
=
(
sys
.
executable
,
'-m'
,
'base64'
)
+
args
return
subprocess
.
check_output
(
args
,
**
options
)
return
subprocess
.
check_output
(
args
,
**
options
)
...
...
Lib/test/test_mailbox.py
View file @
f9596181
...
@@ -7,6 +7,7 @@ import email
...
@@ -7,6 +7,7 @@ import email
import
email.message
import
email.message
import
re
import
re
import
io
import
io
import
shutil
import
tempfile
import
tempfile
from
test
import
support
from
test
import
support
import
unittest
import
unittest
...
@@ -38,12 +39,7 @@ class TestBase(unittest.TestCase):
...
@@ -38,12 +39,7 @@ class TestBase(unittest.TestCase):
def
_delete_recursively
(
self
,
target
):
def
_delete_recursively
(
self
,
target
):
# Delete a file or delete a directory recursively
# Delete a file or delete a directory recursively
if
os
.
path
.
isdir
(
target
):
if
os
.
path
.
isdir
(
target
):
for
path
,
dirs
,
files
in
os
.
walk
(
target
,
topdown
=
False
):
shutil
.
rmtree
(
target
)
for
name
in
files
:
os
.
remove
(
os
.
path
.
join
(
path
,
name
))
for
name
in
dirs
:
os
.
rmdir
(
os
.
path
.
join
(
path
,
name
))
os
.
rmdir
(
target
)
elif
os
.
path
.
exists
(
target
):
elif
os
.
path
.
exists
(
target
):
os
.
remove
(
target
)
os
.
remove
(
target
)
...
@@ -2029,6 +2025,10 @@ class MaildirTestCase(unittest.TestCase):
...
@@ -2029,6 +2025,10 @@ class MaildirTestCase(unittest.TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
# create a new maildir mailbox to work with:
# create a new maildir mailbox to work with:
self
.
_dir
=
support
.
TESTFN
self
.
_dir
=
support
.
TESTFN
if
os
.
path
.
isdir
(
self
.
_dir
):
shutil
.
rmtree
(
self
.
_dir
)
elif
os
.
path
.
isfile
(
self
.
_dir
):
os
.
unlink
(
self
.
_dir
)
os
.
mkdir
(
self
.
_dir
)
os
.
mkdir
(
self
.
_dir
)
os
.
mkdir
(
os
.
path
.
join
(
self
.
_dir
,
"cur"
))
os
.
mkdir
(
os
.
path
.
join
(
self
.
_dir
,
"cur"
))
os
.
mkdir
(
os
.
path
.
join
(
self
.
_dir
,
"tmp"
))
os
.
mkdir
(
os
.
path
.
join
(
self
.
_dir
,
"tmp"
))
...
...
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