From b4a397d15300d6ae6879cbd1132ae1696631e2b9 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Wed, 22 Jan 2014 21:37:59 +0100 Subject: [PATCH] kill ancient capture devnullpath, os.devnull exists since py 2.4 --- _pytest/capture.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/_pytest/capture.py b/_pytest/capture.py index 7734aabf5..b1e823284 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -331,7 +331,7 @@ class FDCapture: "saved filedescriptor not valid, " "did you call start() twice?") if self.targetfd == 0 and not self.tmpfile: - fd = os.open(devnullpath, os.O_RDONLY) + fd = os.open(os.devnull, os.O_RDONLY) os.dup2(fd, 0) os.close(fd) if hasattr(self, '_oldsys'): @@ -639,12 +639,3 @@ class DontReadFromInput: def close(self): pass - - -try: - devnullpath = os.devnull -except AttributeError: - if os.name == 'nt': - devnullpath = 'NUL' - else: - devnullpath = '/dev/null'