Use functools.lru_cache with _getconftest_pathlist
For pytest's own suite the `cache_info()` looks as follows: > session.config._getconftest_pathlist.cache_info() CacheInfo(hits=231, misses=19, maxsize=None, currsize=19) While it does not really make a difference for me this might help with larger test suites / the case mentioned in https://github.com/pytest-dev/pytest/issues/2206#issuecomment-432623646.
This commit is contained in:
parent
2a45851c9e
commit
d40cd3ec6b
|
@ -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
|
||||||
|
@ -893,6 +894,7 @@ class Config(object):
|
||||||
assert type is None
|
assert type is None
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
@functools.lru_cache(maxsize=None)
|
||||||
def _getconftest_pathlist(self, name, path):
|
def _getconftest_pathlist(self, name, path):
|
||||||
try:
|
try:
|
||||||
mod, relroots = self.pluginmanager._rget_with_confmod(name, path)
|
mod, relroots = self.pluginmanager._rget_with_confmod(name, path)
|
||||||
|
|
Loading…
Reference in New Issue