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
653238a8
Commit
653238a8
authored
Oct 30, 2010
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence some ResourceWarning in test_mailbox by using file context managers.
Also call super().tearDown() where appropriate.
parent
d05f9ad3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
Lib/test/test_mailbox.py
Lib/test/test_mailbox.py
+6
-2
No files found.
Lib/test/test_mailbox.py
View file @
653238a8
...
...
@@ -165,8 +165,10 @@ class TestMailbox(TestBase):
# Get file representations of messages
key0
=
self
.
_box
.
add
(
self
.
_template
%
0
)
key1
=
self
.
_box
.
add
(
_sample_message
)
data0
=
self
.
_box
.
get_file
(
key0
).
read
()
data1
=
self
.
_box
.
get_file
(
key1
).
read
()
with
self
.
_box
.
get_file
(
key0
)
as
file
:
data0
=
file
.
read
()
with
self
.
_box
.
get_file
(
key1
)
as
file
:
data1
=
file
.
read
()
self
.
assertEqual
(
data0
.
replace
(
os
.
linesep
,
'
\
n
'
),
self
.
_template
%
0
)
self
.
assertEqual
(
data1
.
replace
(
os
.
linesep
,
'
\
n
'
),
...
...
@@ -773,6 +775,7 @@ class TestMaildir(TestMailbox):
class _TestMboxMMDF(TestMailbox):
def tearDown(self):
super().tearDown()
self._box.close()
self._delete_recursively(self._path)
for lock_remnant in glob.glob(self._path + '.*'):
...
...
@@ -1027,6 +1030,7 @@ class TestBabyl(TestMailbox):
_factory = lambda self, path, factory=None: mailbox.Babyl(path, factory)
def tearDown(self):
super().tearDown()
self._box.close()
self._delete_recursively(self._path)
for lock_remnant in glob.glob(self._path + '.*'):
...
...
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