-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_getconftestmodules: use functools.lru_cache #4247
Conversation
e0728b5
to
216afd7
Compare
There's a simple failure related to renaming the private attribute |
So the failing test on py27 is testing that we are caching diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py
index 20c1e3ec..1124304a 100644
--- a/src/_pytest/config/__init__.py
+++ b/src/_pytest/config/__init__.py
@@ -395,6 +395,11 @@ class PytestPluginManager(PluginManager):
else:
directory = path
+ try:
+ return self._dirpath2confmods[directory]
+ except KeyError:
+ pass
+ But it kind of reduces the point of using I guess it is OK to apply the patch above (perhaps inside a |
Also renames `_path2confmods` to `_dirpath2confmods` for clarity (it is expected to be a dirpath in `_importconftest`). Uses an explicit maxsize, since it appears to be only relevant for a short period [1]. Removes the lru_cache on _getconftest_pathlist, which makes no difference when caching _getconftestmodules, at least with the performance test of 100x10 files (pytest-dev#4237). 1: pytest-dev#4237 (comment)
Thanks, added it with |
Codecov Report
@@ Coverage Diff @@
## features #4247 +/- ##
===========================================
- Coverage 95.83% 92.3% -3.54%
===========================================
Files 111 111
Lines 24777 24769 -8
Branches 2417 2414 -3
===========================================
- Hits 23746 22862 -884
- Misses 734 1512 +778
- Partials 297 395 +98
Continue to review full report at Codecov.
|
Codecov on AppVeyor failed to upload, otherwise it is green. |
Also renames
_path2confmods
to_dirpath2confmods
for clarity (it isexpected to be a dirpath in
_importconftest
).Merges master to avoid conflict with 63691f5 (which should have been done on features probably).