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
9ad6a563
Kaydet (Commit)
9ad6a563
authored
Eki 23, 2012
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#15040: Close files in mailbox tests for PyPy compatibility
Original patch by Matti Picus.
üst
e3d47128
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
11 deletions
+40
-11
test_mailbox.py
Lib/test/test_mailbox.py
+24
-7
test_old_mailbox.py
Lib/test/test_old_mailbox.py
+12
-4
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_mailbox.py
Dosyayı görüntüle @
9ad6a563
...
...
@@ -146,6 +146,7 @@ class TestMailbox(TestBase):
msg
=
self
.
_box
.
get
(
key1
)
self
.
assertEqual
(
msg
[
'from'
],
'foo'
)
self
.
assertEqual
(
msg
.
fp
.
read
(),
'1'
+
os
.
linesep
)
msg
.
fp
.
close
()
def
test_getitem
(
self
):
# Retrieve message using __getitem__()
...
...
@@ -178,10 +179,14 @@ class TestMailbox(TestBase):
# Get file representations of messages
key0
=
self
.
_box
.
add
(
self
.
_template
%
0
)
key1
=
self
.
_box
.
add
(
_sample_message
)
self
.
assertEqual
(
self
.
_box
.
get_file
(
key0
)
.
read
()
.
replace
(
os
.
linesep
,
'
\n
'
),
msg0
=
self
.
_box
.
get_file
(
key0
)
self
.
assertEqual
(
msg0
.
read
()
.
replace
(
os
.
linesep
,
'
\n
'
),
self
.
_template
%
0
)
self
.
assertEqual
(
self
.
_box
.
get_file
(
key1
)
.
read
()
.
replace
(
os
.
linesep
,
'
\n
'
),
msg1
=
self
.
_box
.
get_file
(
key1
)
self
.
assertEqual
(
msg1
.
read
()
.
replace
(
os
.
linesep
,
'
\n
'
),
_sample_message
)
msg0
.
close
()
msg1
.
close
()
def
test_get_file_can_be_closed_twice
(
self
):
# Issue 11700
...
...
@@ -427,6 +432,7 @@ class TestMailbox(TestBase):
self
.
_box
.
add
(
contents
[
0
])
self
.
_box
.
add
(
contents
[
1
])
self
.
_box
.
add
(
contents
[
2
])
oldbox
=
self
.
_box
method
()
if
should_call_close
:
self
.
_box
.
close
()
...
...
@@ -435,6 +441,7 @@ class TestMailbox(TestBase):
self
.
assertEqual
(
len
(
keys
),
3
)
for
key
in
keys
:
self
.
assertIn
(
self
.
_box
.
get_string
(
key
),
contents
)
oldbox
.
close
()
def
test_dump_message
(
self
):
# Write message representations to disk
...
...
@@ -1968,7 +1975,9 @@ class MaildirTestCase(unittest.TestCase):
self
.
createMessage
(
"cur"
)
self
.
mbox
=
mailbox
.
Maildir
(
test_support
.
TESTFN
)
#self.assertTrue(len(self.mbox.boxes) == 1)
self
.
assertIsNot
(
self
.
mbox
.
next
(),
None
)
msg
=
self
.
mbox
.
next
()
self
.
assertIsNot
(
msg
,
None
)
msg
.
fp
.
close
()
self
.
assertIs
(
self
.
mbox
.
next
(),
None
)
self
.
assertIs
(
self
.
mbox
.
next
(),
None
)
...
...
@@ -1976,7 +1985,9 @@ class MaildirTestCase(unittest.TestCase):
self
.
createMessage
(
"new"
)
self
.
mbox
=
mailbox
.
Maildir
(
test_support
.
TESTFN
)
#self.assertTrue(len(self.mbox.boxes) == 1)
self
.
assertIsNot
(
self
.
mbox
.
next
(),
None
)
msg
=
self
.
mbox
.
next
()
self
.
assertIsNot
(
msg
,
None
)
msg
.
fp
.
close
()
self
.
assertIs
(
self
.
mbox
.
next
(),
None
)
self
.
assertIs
(
self
.
mbox
.
next
(),
None
)
...
...
@@ -1985,8 +1996,12 @@ class MaildirTestCase(unittest.TestCase):
self
.
createMessage
(
"new"
)
self
.
mbox
=
mailbox
.
Maildir
(
test_support
.
TESTFN
)
#self.assertTrue(len(self.mbox.boxes) == 2)
self
.
assertIsNot
(
self
.
mbox
.
next
(),
None
)
self
.
assertIsNot
(
self
.
mbox
.
next
(),
None
)
msg
=
self
.
mbox
.
next
()
self
.
assertIsNot
(
msg
,
None
)
msg
.
fp
.
close
()
msg
=
self
.
mbox
.
next
()
self
.
assertIsNot
(
msg
,
None
)
msg
.
fp
.
close
()
self
.
assertIs
(
self
.
mbox
.
next
(),
None
)
self
.
assertIs
(
self
.
mbox
.
next
(),
None
)
...
...
@@ -1995,11 +2010,13 @@ class MaildirTestCase(unittest.TestCase):
import
email.parser
fname
=
self
.
createMessage
(
"cur"
,
True
)
n
=
0
for
msg
in
mailbox
.
PortableUnixMailbox
(
open
(
fname
),
fid
=
open
(
fname
)
for
msg
in
mailbox
.
PortableUnixMailbox
(
fid
,
email
.
parser
.
Parser
()
.
parse
):
n
+=
1
self
.
assertEqual
(
msg
[
"subject"
],
"Simple Test"
)
self
.
assertEqual
(
len
(
str
(
msg
)),
len
(
FROM_
)
+
len
(
DUMMY_MESSAGE
))
fid
.
close
()
self
.
assertEqual
(
n
,
1
)
## End: classes from the original module (for backward compatibility).
...
...
Lib/test/test_old_mailbox.py
Dosyayı görüntüle @
9ad6a563
...
...
@@ -73,7 +73,9 @@ class MaildirTestCase(unittest.TestCase):
self
.
createMessage
(
"cur"
)
self
.
mbox
=
mailbox
.
Maildir
(
test_support
.
TESTFN
)
self
.
assertTrue
(
len
(
self
.
mbox
)
==
1
)
self
.
assertTrue
(
self
.
mbox
.
next
()
is
not
None
)
msg
=
self
.
mbox
.
next
()
self
.
assertTrue
(
msg
is
not
None
)
msg
.
fp
.
close
()
self
.
assertTrue
(
self
.
mbox
.
next
()
is
None
)
self
.
assertTrue
(
self
.
mbox
.
next
()
is
None
)
...
...
@@ -81,7 +83,9 @@ class MaildirTestCase(unittest.TestCase):
self
.
createMessage
(
"new"
)
self
.
mbox
=
mailbox
.
Maildir
(
test_support
.
TESTFN
)
self
.
assertTrue
(
len
(
self
.
mbox
)
==
1
)
self
.
assertTrue
(
self
.
mbox
.
next
()
is
not
None
)
msg
=
self
.
mbox
.
next
()
self
.
assertTrue
(
msg
is
not
None
)
msg
.
fp
.
close
()
self
.
assertTrue
(
self
.
mbox
.
next
()
is
None
)
self
.
assertTrue
(
self
.
mbox
.
next
()
is
None
)
...
...
@@ -90,8 +94,12 @@ class MaildirTestCase(unittest.TestCase):
self
.
createMessage
(
"new"
)
self
.
mbox
=
mailbox
.
Maildir
(
test_support
.
TESTFN
)
self
.
assertTrue
(
len
(
self
.
mbox
)
==
2
)
self
.
assertTrue
(
self
.
mbox
.
next
()
is
not
None
)
self
.
assertTrue
(
self
.
mbox
.
next
()
is
not
None
)
msg
=
self
.
mbox
.
next
()
self
.
assertTrue
(
msg
is
not
None
)
msg
.
fp
.
close
()
msg
=
self
.
mbox
.
next
()
self
.
assertTrue
(
msg
is
not
None
)
msg
.
fp
.
close
()
self
.
assertTrue
(
self
.
mbox
.
next
()
is
None
)
self
.
assertTrue
(
self
.
mbox
.
next
()
is
None
)
...
...
Misc/ACKS
Dosyayı görüntüle @
9ad6a563
...
...
@@ -762,6 +762,7 @@ Gavrie Philipson
Adrian Phillips
Christopher J. Phoenix
Neale Pickett
Matti Picus
Jim St. Pierre
Dan Pierson
Martijn Pieters
...
...
Misc/NEWS
Dosyayı görüntüle @
9ad6a563
...
...
@@ -435,6 +435,9 @@ Extension Modules
Tests
-----
-
Issue
#
15040
:
Close
files
in
mailbox
tests
for
PyPy
compatibility
.
Original
patch
by
Matti
Picus
.
-
Issue
#
15802
:
Fix
test
logic
in
TestMaildir
.
test_create_tmp
.
Patch
by
Serhiy
Storchaka
.
...
...
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