Merge pull request #4227 from blueyed/_getconftest_pathlist-lru

Use functools.lru_cache with _getconftest_pathlist
This commit is contained in:
Ronny Pfannschmidt 2018-10-25 08:12:51 +02:00 committed by GitHub
commit 65b97c2f41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
""" command line options, ini-file and conftest.py processing. """ """ command line options, ini-file and conftest.py processing. """
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
import argparse import argparse
import functools
import inspect import inspect
import shlex import shlex
import types import types
@ -907,6 +908,10 @@ class Config(object):
values.append(relroot) values.append(relroot)
return values return values
if six.PY3:
# once we drop Python 2, please change this to use the normal decorator syntax (#4227)
_getconftest_pathlist = functools.lru_cache(maxsize=None)(_getconftest_pathlist)
def _get_override_ini_value(self, name): def _get_override_ini_value(self, name):
value = None value = None
# override_ini is a list of "ini=value" options # override_ini is a list of "ini=value" options