Exemple #1
0
def test_fd_by_path():
    test_file = tempfile.NamedTemporaryFile()
    try:
        keep = fd_by_path([test_file.name])
        assert keep == [test_file.file.fileno()]
        with patch('os.open') as _open:
            _open.side_effect = OSError()
            assert not fd_by_path([test_file.name])
    finally:
        test_file.close()
Exemple #2
0
 def test_finds(self):
     test_file = tempfile.NamedTemporaryFile()
     try:
         keep = fd_by_path([test_file.name])
         self.assertEqual(keep, [test_file.file.fileno()])
         with patch('os.open') as _open:
             _open.side_effect = OSError()
             self.assertFalse(fd_by_path([test_file.name]))
     finally:
         test_file.close()
Exemple #3
0
def test_fd_by_path():
    test_file = tempfile.NamedTemporaryFile()
    try:
        keep = fd_by_path([test_file.name])
        assert keep == [test_file.file.fileno()]
        with patch('os.open') as _open:
            _open.side_effect = OSError()
            assert not fd_by_path([test_file.name])
    finally:
        test_file.close()
Exemple #4
0
 def test_finds(self):
     test_file = tempfile.NamedTemporaryFile()
     try:
         keep = fd_by_path([test_file.name])
         self.assertEqual(keep, [test_file.file.fileno()])
         with patch('os.open') as _open:
             _open.side_effect = OSError()
             self.assertFalse(fd_by_path([test_file.name]))
     finally:
         test_file.close()
Exemple #5
0
 def test_finds(self):
     test_file = tempfile.NamedTemporaryFile()
     keep = fd_by_path([test_file.name])
     self.assertEqual(keep, [test_file.file.fileno()])
     test_file.close()
Exemple #6
0
 def test_finds(self):
     test_file = tempfile.NamedTemporaryFile()
     keep = fd_by_path([test_file.name])
     self.assertEqual(keep, [test_file.file.fileno()])
     test_file.close()