Issue #12326: refactor usage of sys.platform

* Use str.startswith(tuple): I didn't know this Python feature, Python rocks!
 * Replace sometimes sys.platform.startswith('linux') with
   sys.platform == 'linux'
 * sys.platform doesn't contain the major version on Cygwin on Mac OS X
   (it's just 'cygwin' and 'darwin')
This commit is contained in:
Victor Stinner 2011-08-21 00:39:18 +02:00
parent a9931888ed
commit e67474725b
8 changed files with 12 additions and 20 deletions

View file

@ -527,7 +527,7 @@ class HandlerTest(BaseTest):
def test_builtin_handlers(self):
# We can't actually *use* too many handlers in the tests,
# but we can try instantiating them with various options
if sys.platform.startswith('linux') or sys.platform == 'darwin':
if sys.platform in ('linux', 'darwin'):
for existing in (True, False):
fd, fn = tempfile.mkstemp()
os.close(fd)