Branch: refs/heads/master
Home:
https://github.com/tribe29/checkmk
Commit: 43f690ff629aabe076ad74627e2b7da30696cee1
https://github.com/tribe29/checkmk/commit/43f690ff629aabe076ad74627e2b7da30…
Author: Lars Michelsen <lm(a)tribe29.com>
Date: 2020-10-20 (Tue, 20 Oct 2020)
Changed paths:
M tests/unit/cmk/base/checkers/test_cmd_caching.py
Log Message:
-----------
Additional inventory test improvement
One more caching test does not need to execute the plugins.
Change-Id: Iafda99392c3c567826099b74bdd1d80ec617eea3
Commit: 86516bbc4ec8d0610bdd94f2e3e745ca8a5c27cc
https://github.com/tribe29/checkmk/commit/86516bbc4ec8d0610bdd94f2e3e745ca8…
Author: Lars Michelsen <lm(a)tribe29.com>
Date: 2020-10-20 (Tue, 20 Oct 2020)
Changed paths:
M omd/packages/omd/omdlib/contexts.py
M omd/packages/omd/omdlib/main.py
M omd/packages/omd/omdlib/utils.py
M tests/unit/cmk/base/checkers/test_agent.py
M tests/unit/cmk/fetchers/test_fetchers.py
M tests/unit/cmk/gui/watolib/test_hosts_and_folders.py
M tests/unit/omdlib/test_omdlib_main.py
Log Message:
-----------
Replace pyfakefs calls with way faster pytest standard fixture
pyfakefs looked like a handy tool, but has important drawbacks:
The pyfakefs fixture is very resource hungy. The Patcher searches all
modules registered to sys.modules for access to IO functions and patches
them. In our test environment the pyfakefs fixture setup phase was
consuming half of the test execution time.
To improve this, we'll have to replace all possible uses of pyfakefs.
Especially the call sites that just need access to some dirctories or
files in a temporary directoy can easily be replaced with the standard
pytest tmp_path fixture.
For the other call sites, which really want to access hard coded system
wide paths, these are the OMD tests, we had to introduce some dynamic
path prefix. This allows us to replace pyfakefs also in for these tests
without having to refactor larger parts of the OMD code.
With this change we are now down to 2(!!) minutes with our whole
collection of unit test
```
time pytest -T unit tests/unit/
========================================= test session starts
=========================================
platform linux -- Python 3.8.5, pytest-6.1.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/lm/git/checkmk, configfile: pytest.ini
plugins: testmon-1.0.3, mock-3.3.1, cov-2.10.1, profiling-1.7.0, pyfakefs-4.1.0,
requests-mock-1.8.0
collected 7808 items
(...)
====================== 7794 passed, 14 skipped, 35 warnings in 113.32s (0:01:53)
======================
real 1m56,275s
user 1m18,824s
sys 0m14,788s
```
Change-Id: I3d53303830ba6103035d4e293b045dd750ad978f
Compare:
https://github.com/tribe29/checkmk/compare/20f9eced862c...86516bbc4ec8