Skip to content

Commit

Permalink
iQIcBAABCAAGBQJXj88NAAoJEObgNkBNX4V0xjkP/jJvd2bevjPTFHKOspDErTtm
Browse files Browse the repository at this point in the history
 NIMUstA8lOQd9w5kL+PcYC3o+J7vh1/gjIyJsZ5iE9y9zQ3aYtzFQShPnCfrKYyl
 Bco/xr+U3bN9piXTZqhYKIRzVUs6SSd2uy7q63de8QDNsNWkKouKZ1+PhvZPkMNN
 i+PhBW/gp+PXeta+4Y5REnBrUpX4bW3DCHuKTJ+nM80PXmsMG0i64ShRX/umXnoG
 qpBfOGfnr40SD/ZFmmYc8qqZvllzPjew8GMGXXdjidetOZHaAkFRDMzOr3FNYkWD
 2zSKN95CJGDynSwdsDTo9rrUN5lcJr58JG+JeDBLoK7XxN5VVhPge+cV0gHF2SLk
 TQcgRXXY/AJY0ZpME0PRk7YKpUPqW/UjKPHENRFqNPlskF+8dzvFu2KNk928A+Ws
 4otsRWCzn76tzXsGAK66kXsX9l2mc3IxhDy9TH69GXhog7ASHlglJZ1kZTcPPR8T
 h7SfjW1Pfi7C/HL7RJ+shmmIQd4qvfn828JK/SoHud6dG7/wmfqYIiva7RB0usdt
 CK8y7an2XUGXjnvIv2C2CDUHKy0KgtdRw6wpwChkeVl9ci59cT0vHkOZqXgGSaBS
 L168OTkm0djbpjrMGj8vWe3lna1/Fxf+ELYOC/rUTPOYt7T0SuRoUHhcHhURCD/w
 vViD4Ic6nvs7OR+ODkyZ
 =eUcw
 -----END PGP SIGNATURE-----

adjusted HOLE open file descriptor test (MDAnalysis#129) for Darwin

In order to provoke the failure described by issue MDAnalysis#129 we artificially lower the open file descriptors.
On Mac OS X on travis this always leads to failing tests, as discussed under
MDAnalysis#901 (comment) ; this hack increases the allowed
open fds when we are running on Darwin. According to @jbarnoud, this problem is solved by MDAnalysis#363 so once that
corresponding PR MDAnalysis#815 is merged we should be able to revert this commit.
  • Loading branch information
orbeckst committed Jul 20, 2016
1 parent 35b623c commit 7568efb
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions testsuite/MDAnalysisTests/analysis/test_hole.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,32 @@ def setUp(self):
@dec.skipif(rlimits_missing, msg="Test skipped because platform does not allow setting rlimits")
@dec.skipif(executable_not_found("hole"), msg="Test skipped because HOLE not found")
def test_hole_module_fd_closure(self):
"""MDAnalysis.analysis.hole: Issue 129: ensure low level file descriptors to PDB files used by Hole program are properly closed"""
"""test open file descriptors are closed (MDAnalysisTests.analysis.test_hole.TestHoleModule): Issue 129"""
# If Issue 129 isn't resolved, this function will produce an OSError on
# the system, and cause many other tests to fail as well.
#
# Successful test takes ~10 s, failure ~2 s.

# Hasten failure by setting "ulimit -n 64" (can't go too low because of open modules etc...)
import resource
resource.setrlimit(resource.RLIMIT_NOFILE, (64, self.hard_max_open_files))

# ----- temporary hack -----
# on Mac OS X (on Travis) we run out of open file descriptors
# before even starting this test (see
# https://github.com/MDAnalysis/mdanalysis/pull/901#issuecomment-231938093);
# if this issue is solved by #363 then revert the following
# hack:
#
import platform
if platform.platform() == "Darwin":
max_open_files = 512
else:
max_open_files = 64
#
# --------------------------

resource.setrlimit(resource.RLIMIT_NOFILE,
(max_open_files, self.hard_max_open_files))

with tempdir.in_tempdir():
try:
Expand All @@ -221,7 +238,8 @@ def test_hole_module_fd_closure(self):
def _restore_rlimits(self):
try:
import resource
resource.setrlimit(resource.RLIMIT_NOFILE, (self.soft_max_open_files, self.hard_max_open_files))
resource.setrlimit(resource.RLIMIT_NOFILE,
(self.soft_max_open_files, self.hard_max_open_files))
except ImportError:
pass

Expand Down

0 comments on commit 7568efb

Please sign in to comment.