summaryrefslogtreecommitdiff
path: root/conftest.py
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2018-11-01 11:25:36 -0400
committerBenjamin Schubert <bschubert15@bloomberg.net>2018-11-08 10:21:12 +0000
commitcf2e0059880058f0672aebb38f57fc43d347ae9a (patch)
tree311eea8303ff52a97b132cbb93127037a4798538 /conftest.py
parent9f0e12f15f29ea48f1d8b242d233889806942cf8 (diff)
downloadbuildstream-cf2e0059880058f0672aebb38f57fc43d347ae9a.tar.gz
conftest.py: Ensure platform is not maintained between tests
This removes the `_instance` on the platform object that we use for caching and not recreating the object everytime at the start of every test. This is to ensure our tests share the least amount of state. The performance penalty is from 5 to 10% accross the whole test suite. The readings were done 5 times for each before and after the change and on the same computer.
Diffstat (limited to 'conftest.py')
-rwxr-xr-xconftest.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/conftest.py b/conftest.py
index 99a602db4..1f0259f0f 100755
--- a/conftest.py
+++ b/conftest.py
@@ -23,6 +23,8 @@ import shutil
import pytest
+from buildstream._platform.platform import Platform
+
def pytest_addoption(parser):
parser.addoption('--integration', action='store_true', default=False,
@@ -52,3 +54,8 @@ def integration_cache(request):
shutil.rmtree(os.path.join(cache_dir, 'artifacts'))
except FileNotFoundError:
pass
+
+
+@pytest.fixture(autouse=True)
+def clean_platform_cache():
+ Platform._instance = None