summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-07-16 15:51:39 +0200
committerbst-marge-bot <marge-bot@buildstream.build>2019-07-17 10:42:53 +0000
commitdf92e8e08ea4ddfd58d6cfbf63d758cda5d3d44f (patch)
tree18552a6b837d8df1a4ec01a2d043d0a64634890f /tests
parent6160a64cfc4788d9c7e0519b77f55ed870b6a6a7 (diff)
downloadbuildstream-df92e8e08ea4ddfd58d6cfbf63d758cda5d3d44f.tar.gz
Store Platform reference in Context instance variable
This allows us to remove the platform reset helpers in tests/conftest.py.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/conftest.py17
-rw-r--r--tests/integration/cachedfail.py6
-rw-r--r--tests/sandboxes/fallback.py4
-rw-r--r--tests/sandboxes/selection.py6
4 files changed, 0 insertions, 33 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 138ae0745..77f8666a6 100755
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -21,7 +21,6 @@
#
import os
import pytest
-from buildstream._platform.platform import Platform
from buildstream.testing import register_repo_kind, sourcetests_collection_hook
from buildstream.testing.integration import integration_cache # pylint: disable=unused-import
@@ -103,22 +102,6 @@ def remote_services(request):
#################################################
-# Automatically reset the platform #
-#################################################
-#
-# This might need some refactor, maybe buildstream
-# needs to cleanup more gracefully and we could remove this.
-#
-def clean_platform_cache():
- Platform._instance = None
-
-
-@pytest.fixture(autouse=True)
-def ensure_platform_cache_is_clean():
- clean_platform_cache()
-
-
-#################################################
# Setup for templated source tests #
#################################################
register_repo_kind('git', Git)
diff --git a/tests/integration/cachedfail.py b/tests/integration/cachedfail.py
index 467d3968f..a7509ab3b 100644
--- a/tests/integration/cachedfail.py
+++ b/tests/integration/cachedfail.py
@@ -25,7 +25,6 @@ from buildstream._exceptions import ErrorDomain
from buildstream.testing import cli_integration as cli # pylint: disable=unused-import
from buildstream.testing._utils.site import HAVE_SANDBOX
-from tests.conftest import clean_platform_cache
from tests.testutils import create_artifact_share
@@ -206,16 +205,11 @@ def test_host_tools_errors_are_not_cached(cli, datafiles):
}
_yaml.roundtrip_dump(element, element_path)
- clean_platform_cache()
-
# Build without access to host tools, this will fail
result1 = cli.run(project=project, args=['build', 'element.bst'], env={'PATH': '', 'BST_FORCE_SANDBOX': None})
result1.assert_task_error(ErrorDomain.SANDBOX, 'unavailable-local-sandbox')
assert cli.get_element_state(project, 'element.bst') == 'buildable'
- # clean the cache before running again
- clean_platform_cache()
-
# When rebuilding, this should work
result2 = cli.run(project=project, args=['build', 'element.bst'])
result2.assert_success()
diff --git a/tests/sandboxes/fallback.py b/tests/sandboxes/fallback.py
index d8170c61d..f2f585e70 100644
--- a/tests/sandboxes/fallback.py
+++ b/tests/sandboxes/fallback.py
@@ -23,8 +23,6 @@ from buildstream import _yaml
from buildstream._exceptions import ErrorDomain
from buildstream.testing import cli # pylint: disable=unused-import
-from tests.conftest import clean_platform_cache
-
pytestmark = pytest.mark.integration
@@ -56,8 +54,6 @@ def test_fallback_platform_fails(cli, datafiles):
}
_yaml.roundtrip_dump(element, element_path)
- clean_platform_cache()
-
result = cli.run(project=project, args=['build', 'element.bst'],
env={'BST_FORCE_BACKEND': 'fallback',
'BST_FORCE_SANDBOX': None})
diff --git a/tests/sandboxes/selection.py b/tests/sandboxes/selection.py
index 50406b4cb..eff247a95 100644
--- a/tests/sandboxes/selection.py
+++ b/tests/sandboxes/selection.py
@@ -23,8 +23,6 @@ from buildstream import _yaml
from buildstream._exceptions import ErrorDomain
from buildstream.testing import cli # pylint: disable=unused-import
-from tests.conftest import clean_platform_cache
-
pytestmark = pytest.mark.integration
@@ -56,8 +54,6 @@ def test_force_sandbox(cli, datafiles):
}
_yaml.roundtrip_dump(element, element_path)
- clean_platform_cache()
-
# Build without access to host tools, this will fail
result = cli.run(project=project, args=['build', 'element.bst'], env={'PATH': '', 'BST_FORCE_SANDBOX': 'bwrap'})
result.assert_main_error(ErrorDomain.PLATFORM, None)
@@ -89,8 +85,6 @@ def test_dummy_sandbox_fallback(cli, datafiles):
}
_yaml.roundtrip_dump(element, element_path)
- clean_platform_cache()
-
# Build without access to host tools, this will fail
result = cli.run(project=project, args=['build', 'element.bst'], env={'PATH': '', 'BST_FORCE_SANDBOX': None})
# But if we dont spesify a sandbox then we fall back to dummy, we still