Merge pull request #2784 from RonnyPfannschmidt/fix-fdleaks

pytester: ignore files used to obtain current user metadata
This commit is contained in:
Ronny Pfannschmidt 2017-12-19 17:08:53 +01:00 committed by GitHub
commit 672c901c70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,11 @@ from _pytest.assertion.rewrite import AssertionRewritingHook
PYTEST_FULLPATH = os.path.abspath(pytest.__file__.rstrip("oc")).replace("$py.class", ".py") PYTEST_FULLPATH = os.path.abspath(pytest.__file__.rstrip("oc")).replace("$py.class", ".py")
IGNORE_PAM = [ # filenames added when obtaining details about the current user
u'/var/lib/sss/mc/passwd'
]
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption('--lsof', parser.addoption('--lsof',
action="store_true", dest="lsof", default=False, action="store_true", dest="lsof", default=False,
@ -66,6 +71,8 @@ class LsofFdLeakChecker(object):
fields = line.split('\0') fields = line.split('\0')
fd = fields[0][1:] fd = fields[0][1:]
filename = fields[1][1:] filename = fields[1][1:]
if filename in IGNORE_PAM:
continue
if filename.startswith('/'): if filename.startswith('/'):
open_files.append((fd, filename)) open_files.append((fd, filename))

1
changelog/2784.bugfix Normal file
View File

@ -0,0 +1 @@
pytester: ignore files used to obtain current user metadata in the fd leak detector.