diff --git a/package/AUTHORS b/package/AUTHORS index 0b7102ac8f5..4aef6d32e2c 100644 --- a/package/AUTHORS +++ b/package/AUTHORS @@ -63,6 +63,7 @@ Chronological list of authors - Max Linke - Gorman Stock - Jonathan Barnoud + - Hai Nguyen External code ------------- diff --git a/package/doc/sphinx/source/conf.py b/package/doc/sphinx/source/conf.py index bb278abcbcf..85e0ea4f4d5 100644 --- a/package/doc/sphinx/source/conf.py +++ b/package/doc/sphinx/source/conf.py @@ -84,10 +84,11 @@ def __getattr__(cls, name): Xavier Deupi, Jan Domański, David L. Dotson, Lennard van der Feltz, Philip Fowler, Joseph Goose, Richard J. Gowers, Lukas Grossar, Benjamin Hall, Joe Jordan, Max Linke, Jinju Lu, Robert - McGibbon, Alex Nesterenko, Manuel Nuno Melo, Caio S. Souza, Danny - Parton, Joshua L. Phillips, Tyler Reddy, Paul Rigor, Sean - L. Seyler, Andy Somogyi, Lukas Stelzl, Gorman Stock, Isaac - Virshup, Zhuyi Xue, Carlos Yáñez S., and Oliver Beckstein""" + McGibbon, Alex Nesterenko, Manuel Nuno Melo, Hai Nguyen, + Caio S. Souza, Danny Parton, Joshua L. Phillips, Tyler Reddy, + Paul Rigor, Sean L. Seyler, Andy Somogyi, Lukas Stelzl, + Gorman Stock, Isaac Virshup, Zhuyi Xue, Carlos Yáñez S., + and Oliver Beckstein""" project = u'MDAnalysis' copyright = u'2005-2015, ' + authors diff --git a/testsuite/MDAnalysisTests/analysis/test_hole.py b/testsuite/MDAnalysisTests/analysis/test_hole.py index bef2c3d5d10..c01e762b071 100644 --- a/testsuite/MDAnalysisTests/analysis/test_hole.py +++ b/testsuite/MDAnalysisTests/analysis/test_hole.py @@ -17,16 +17,15 @@ import MDAnalysis import MDAnalysis.analysis.hole +from MDAnalysis.analysis.hole import HOLEtraj from numpy.testing import TestCase, dec import numpy as np import nose from nose.plugins.attrib import attr -import os import errno -import tempfile -import shutil +import tempdir from MDAnalysisTests.datafiles import PDB_HOLE, XTC_HOLE from MDAnalysisTests import executable_not_found @@ -45,11 +44,9 @@ def rlimits_missing(): class TestHoleModule(TestCase): def setUp(self): self.universe = MDAnalysis.Universe(PDB_HOLE, XTC_HOLE) - self.dir_name = tempfile.mkdtemp() try: # on Unix we can manipulate our limits: http://docs.python.org/2/library/resource.html import resource - self.soft_max_open_files, self.hard_max_open_files = resource.getrlimit(resource.RLIMIT_NOFILE) except ImportError: pass @@ -67,41 +64,38 @@ def test_hole_module_fd_closure(self): try: # 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)) except ImportError: raise NotImplementedError("Test cannot be run without the resource module.") - import errno - from MDAnalysis.analysis.hole import HOLEtraj - os.chdir(self.dir_name) - try: - # will need to have the 'hole' command available in the path - H = HOLEtraj(self.universe, cvect=[0, 1, 0], sample=20.0) - except OSError as err: - if err.errno == errno.ENOENT: - raise OSError(errno.ENOENT, "HOLE binary not found") - raise - finally: - self._restore_rlimits() - - # pretty unlikely that the code will get through 2 rounds if the MDA - # issue 129 isn't fixed, although this depends on the file descriptor - # open limit for the machine in question - try: - for i in xrange(2): - # will typically get an OSError for too many files being open after - # about 2 seconds if issue 129 isn't resolved - H.run() - except OSError as err: - if err.errno == errno.EMFILE: - raise AssertionError("HOLEtraj does not close file descriptors (Issue 129)") - elif err.errno == errno.ENOENT: - raise OSError(errno.ENOENT, "HOLE binary not found") - raise - finally: - # make sure to restore open file limit !! - self._restore_rlimits() + with tempdir.in_tempdir(): + try: + # will need to have the 'hole' command available in the path + H = HOLEtraj(self.universe, cvect=[0, 1, 0], sample=20.0) + except OSError as err: + if err.errno == errno.ENOENT: + raise OSError(errno.ENOENT, "HOLE binary not found") + raise + finally: + self._restore_rlimits() + + # pretty unlikely that the code will get through 2 rounds if the MDA + # issue 129 isn't fixed, although this depends on the file descriptor + # open limit for the machine in question + try: + for i in xrange(2): + # will typically get an OSError for too many files being open after + # about 2 seconds if issue 129 isn't resolved + H.run() + except OSError as err: + if err.errno == errno.EMFILE: + raise AssertionError("HOLEtraj does not close file descriptors (Issue 129)") + elif err.errno == errno.ENOENT: + raise OSError(errno.ENOENT, "HOLE binary not found") + raise + finally: + # make sure to restore open file limit !! + self._restore_rlimits() def _restore_rlimits(self): try: @@ -114,6 +108,5 @@ def _restore_rlimits(self): def tearDown(self): self._restore_rlimits() del self.universe - shutil.rmtree(self.dir_name, ignore_errors=True)