Commit 5a1ed45a authored by Kirill Smelkov's avatar Kirill Smelkov

py.bench: Don't forget to clear config's inicache after tweaking config.inicfg

If py.test machinery access any of the keys we change before we tweak
them - their values will be put to config._inicache and our tweaking
won't essentially have the effect.

It used to be working without explicit cache invalidation with older
pytests, but as of e.g. py.test 3.2.1 it does not work without explicit
cache clearing because e.g. 'python_files' is somehow accessed before
and is set to std 'test_*.py' + friends in the cache and this way
py.bench then does not collect benchmarks from bench_*.py files.

Fix it by making sure inicache is invalidated after our inicfg tweak.
parent 9e471114
...@@ -62,6 +62,7 @@ class BenchPlugin: ...@@ -62,6 +62,7 @@ class BenchPlugin:
ini['python_files'] = 'bench_*.py' ini['python_files'] = 'bench_*.py'
ini['python_classes'] = 'Bench' ini['python_classes'] = 'Bench'
ini['python_functions'] = 'bench_' ini['python_functions'] = 'bench_'
config._inicache.clear()
def pytest_addoption(self, parser): def pytest_addoption(self, parser):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment