diff options
author | Allan Que <allan.que@gmail.com> | 2018-01-20 16:14:20 -0600 |
---|---|---|
committer | Allan Que <allan.que@gmail.com> | 2018-01-20 16:18:24 -0600 |
commit | 1d0cf54337ba705ea30d334b710992b8d6cf418f (patch) | |
tree | d64a0dd7817490b54298caedcb335412128764e0 /tests/test_bio_file.py | |
parent | 62a1af1ca1a326dcc1216f8b7f6d06e76b77b622 (diff) | |
download | m2crypto-1d0cf54337ba705ea30d334b710992b8d6cf418f.tar.gz |
test_bio_file: support OSX and BSD file descriptors
Fixes #196
Diffstat (limited to 'tests/test_bio_file.py')
-rw-r--r-- | tests/test_bio_file.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_bio_file.py b/tests/test_bio_file.py index e719783..ccb452b 100644 --- a/tests/test_bio_file.py +++ b/tests/test_bio_file.py @@ -24,14 +24,16 @@ class FileTestCase(unittest.TestCase): self.data = b'abcdef' * 64 self.fd, self.fname = tempfile.mkstemp() - # This could possibly work with other systems having proc - # filesystem, e.g. FreeBSD? Certainly it does NOT work on Macs - # https://gitlab.com/m2crypto/m2crypto/issues/196 if platform.system() in ['Linux']: self._proc = "/proc/{0}/fd/".format(os.getpid()) - self.max_fd = self.mfd() + elif platform.system() in ['Darwin', 'FreeBSD']: + self._proc = "/dev/fd/" + else: + self.skipTest('File descriptors directory not found.') - # FIXME: this does not work on Windows and Macs provide and test + self.max_fd = self.mfd() + + # FIXME: this does not work on Windows. Provide and test # a fallback method, like # os.fdopen().fileno()-1 def mfd(self): |