diff options
author | Jürg Billeter <j@bitron.ch> | 2019-07-09 15:55:18 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-07-16 15:36:10 +0200 |
commit | b7e7f6e6e72c13cea04596d47669c5ee63f58988 (patch) | |
tree | cab0bfbbb98453316a0699cf6de6d52e363d0635 /tests/artifactcache | |
parent | 2fc76fca4d48e8dfcfa815f06aafe8f406619dc4 (diff) | |
download | buildstream-b7e7f6e6e72c13cea04596d47669c5ee63f58988.tar.gz |
tests/artifactcache/config.py: Use dummy_context()
Diffstat (limited to 'tests/artifactcache')
-rw-r--r-- | tests/artifactcache/config.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/artifactcache/config.py b/tests/artifactcache/config.py index db51d196c..08d6f74bb 100644 --- a/tests/artifactcache/config.py +++ b/tests/artifactcache/config.py @@ -7,7 +7,6 @@ import os import pytest from buildstream._artifactcache import ArtifactCacheSpec, ArtifactCache -from buildstream._context import Context from buildstream._project import Project from buildstream.utils import _deduplicate from buildstream import _yaml @@ -15,6 +14,8 @@ from buildstream._exceptions import ErrorDomain, LoadErrorReason from buildstream.testing.runcli import cli # pylint: disable=unused-import +from tests.testutils import dummy_context + DATA_DIR = os.path.dirname(os.path.realpath(__file__)) cache1 = ArtifactCacheSpec(url='https://example.com/cache1', push=True) @@ -107,17 +108,16 @@ def test_artifact_cache_precedence(tmpdir, override_caches, project_caches, user project_config_file = str(project_dir.join('project.conf')) _yaml.roundtrip_dump(project_config, file=project_config_file) - context = Context() - context.load(config=user_config_file) - project = Project(str(project_dir), context) - project.ensure_fully_loaded() + with dummy_context(config=user_config_file) as context: + project = Project(str(project_dir), context) + project.ensure_fully_loaded() - # Use the helper from the artifactcache module to parse our configuration. - parsed_cache_specs = ArtifactCache._configured_remote_cache_specs(context, project) + # Use the helper from the artifactcache module to parse our configuration. + parsed_cache_specs = ArtifactCache._configured_remote_cache_specs(context, project) - # Verify that it was correctly read. - expected_cache_specs = list(_deduplicate(itertools.chain(override_caches, project_caches, user_caches))) - assert parsed_cache_specs == expected_cache_specs + # Verify that it was correctly read. + expected_cache_specs = list(_deduplicate(itertools.chain(override_caches, project_caches, user_caches))) + assert parsed_cache_specs == expected_cache_specs # Assert that if either the client key or client cert is specified |