Issue #19572: More silently skipped tests explicitly skipped.
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index e7955cc..c2a63ad 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -283,28 +283,29 @@
self.assertEqual(f.seekable(), True)
self.assertEqual(f.isatty(), False)
f.close()
-
- if sys.platform != "win32":
- try:
- f = _FileIO("/dev/tty", "a")
- except EnvironmentError:
- # When run in a cron job there just aren't any
- # ttys, so skip the test. This also handles other
- # OS'es that don't support /dev/tty.
- pass
- else:
- self.assertEqual(f.readable(), False)
- self.assertEqual(f.writable(), True)
- if sys.platform != "darwin" and \
- 'bsd' not in sys.platform and \
- not sys.platform.startswith('sunos'):
- # Somehow /dev/tty appears seekable on some BSDs
- self.assertEqual(f.seekable(), False)
- self.assertEqual(f.isatty(), True)
- f.close()
finally:
os.unlink(TESTFN)
+ @unittest.skipIf(sys.platform == 'win32', 'no ttys on Windows')
+ def testAblesOnTTY(self):
+ try:
+ f = _FileIO("/dev/tty", "a")
+ except EnvironmentError:
+ # When run in a cron job there just aren't any
+ # ttys, so skip the test. This also handles other
+ # OS'es that don't support /dev/tty.
+ self.skipTest('need /dev/tty')
+ else:
+ self.assertEqual(f.readable(), False)
+ self.assertEqual(f.writable(), True)
+ if sys.platform != "darwin" and \
+ 'bsd' not in sys.platform and \
+ not sys.platform.startswith('sunos'):
+ # Somehow /dev/tty appears seekable on some BSDs
+ self.assertEqual(f.seekable(), False)
+ self.assertEqual(f.isatty(), True)
+ f.close()
+
def testInvalidModeStrings(self):
# check invalid mode strings
for mode in ("", "aU", "wU+", "rw", "rt"):
@@ -342,8 +343,7 @@
try:
fn = TESTFN.encode("ascii")
except UnicodeEncodeError:
- # Skip test
- return
+ self.skipTest('could not encode %r to ascii' % TESTFN)
f = _FileIO(fn, "w")
try:
f.write(b"abc")