Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2e36ba

Browse files
committed
posix.fdopen does not exists any more; and os.fdopen exists on all platforms.
Move tests from test_posix to test_os.
1 parent bdbddf8 commit e2e36ba

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

Lib/test/test_os.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ def test_tmpnam(self):
134134
else:
135135
self.check_tempfile(name)
136136

137+
def fdopen_helper(self, *args):
138+
fd = os.open(support.TESTFN, os.O_RDONLY)
139+
fp2 = os.fdopen(fd, *args)
140+
fp2.close()
141+
142+
def test_fdopen(self):
143+
self.fdopen_helper()
144+
self.fdopen_helper('r')
145+
self.fdopen_helper('r', 100)
146+
137147
# Test attributes on return values from os.*stat* family.
138148
class StatAttributeTests(unittest.TestCase):
139149
def setUp(self):

Lib/test/test_posix.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,6 @@ def test_dup2(self):
8989
fp1.close()
9090
fp2.close()
9191

92-
def fdopen_helper(self, *args):
93-
fd = os.open(support.TESTFN, os.O_RDONLY)
94-
fp2 = posix.fdopen(fd, *args)
95-
fp2.close()
96-
97-
def test_fdopen(self):
98-
if hasattr(posix, 'fdopen'):
99-
self.fdopen_helper()
100-
self.fdopen_helper('r')
101-
self.fdopen_helper('r', 100)
102-
10392
def test_osexlock(self):
10493
if hasattr(posix, "O_EXLOCK"):
10594
fd = os.open(support.TESTFN,

0 commit comments

Comments
 (0)