LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Public Member Functions | List of all members
lsst.utils.tests.MemoryTestCase Class Reference
Inheritance diagram for lsst.utils.tests.MemoryTestCase:

Public Member Functions

def tearDownClass (cls)
 
def testFileDescriptorLeaks (self)
 

Detailed Description

Check for resource leaks.

Definition at line 125 of file tests.py.

Member Function Documentation

◆ tearDownClass()

def lsst.utils.tests.MemoryTestCase.tearDownClass (   cls)
Reset the leak counter when the tests have been completed

Definition at line 129 of file tests.py.

129  def tearDownClass(cls):
130  """Reset the leak counter when the tests have been completed"""
131  init()
132 
def init()
Definition: tests.py:65

◆ testFileDescriptorLeaks()

def lsst.utils.tests.MemoryTestCase.testFileDescriptorLeaks (   self)
Check if any file descriptors are open since init() called.

Definition at line 133 of file tests.py.

133  def testFileDescriptorLeaks(self):
134  """Check if any file descriptors are open since init() called."""
135  if psutil is None:
136  self.skipTest("Unable to test file descriptor leaks. psutil unavailable.")
137  gc.collect()
138  global open_files
139  now_open = _get_open_files()
140 
141  # Some files are opened out of the control of the stack.
142  now_open = set(f for f in now_open if not f.endswith(".car") and
143  not f.startswith("/proc/") and
144  not f.endswith(".ttf") and
145  not (f.startswith("/var/lib/") and f.endswith("/passwd")) and
146  not f.endswith("astropy.log"))
147 
148  diff = now_open.difference(open_files)
149  if diff:
150  for f in diff:
151  print("File open: %s" % f)
152  self.fail("Failed to close %d file%s" % (len(diff), "s" if len(diff) != 1 else ""))
153 
154 
daf::base::PropertySet * set
Definition: fits.cc:902

The documentation for this class was generated from the following file: