summaryrefslogtreecommitdiff
path: root/src/buildstream
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-08-20 13:01:59 +0100
committerBenjamin Schubert <contact@benschubert.me>2019-08-26 22:14:40 +0100
commit2c8da65b527243c213d3414f4c944439a25ccd3f (patch)
tree850a516392c2502da17ab238077b6236169240f4 /src/buildstream
parentf759b92e29339d45967477d8218a9a93a9dd3c99 (diff)
downloadbuildstream-2c8da65b527243c213d3414f4c944439a25ccd3f.tar.gz
sourcetests/track: Don't overwrite project configurationbschubert/register-sources-on-test
We need to keep the project configuration to use the expected plugins as configured by the `kind` fixture. This adds a utility method `update_project_configuration` that allows updated part of the project.conf.
Diffstat (limited to 'src/buildstream')
-rw-r--r--src/buildstream/testing/_sourcetests/fetch.py5
-rw-r--r--src/buildstream/testing/_sourcetests/track.py13
-rw-r--r--src/buildstream/testing/_utils/__init__.py9
3 files changed, 10 insertions, 17 deletions
diff --git a/src/buildstream/testing/_sourcetests/fetch.py b/src/buildstream/testing/_sourcetests/fetch.py
index 220696f55..897752297 100644
--- a/src/buildstream/testing/_sourcetests/fetch.py
+++ b/src/buildstream/testing/_sourcetests/fetch.py
@@ -23,9 +23,10 @@ import os
import pytest
from buildstream import _yaml
-from .._utils import generate_junction, configure_project
+from .._utils import generate_junction
from .. import create_repo
from .. import cli # pylint: disable=unused-import
+from .utils import update_project_configuration
from .utils import kind # pylint: disable=unused-import
@@ -90,7 +91,7 @@ def test_fetch_cross_junction(cli, tmpdir, datafiles, ref_storage, kind):
}
_yaml.roundtrip_dump(element, import_etc_path)
- configure_project(project, {
+ update_project_configuration(project, {
'ref-storage': ref_storage
})
diff --git a/src/buildstream/testing/_sourcetests/track.py b/src/buildstream/testing/_sourcetests/track.py
index ca8128fd6..48856b351 100644
--- a/src/buildstream/testing/_sourcetests/track.py
+++ b/src/buildstream/testing/_sourcetests/track.py
@@ -24,9 +24,10 @@ import pytest
from buildstream import _yaml
from buildstream._exceptions import ErrorDomain
-from .._utils import generate_junction, configure_project
+from .._utils import generate_junction
from .. import create_repo
from .. import cli # pylint: disable=unused-import
+from .utils import update_project_configuration
from .utils import kind # pylint: disable=unused-import
@@ -56,7 +57,7 @@ def test_track(cli, tmpdir, datafiles, ref_storage, kind):
element_path = os.path.join(project, 'elements')
element_name = 'track-test-{}.bst'.format(kind)
- configure_project(project, {
+ update_project_configuration(project, {
'ref-storage': ref_storage
})
@@ -226,7 +227,7 @@ def test_cross_junction(cli, tmpdir, datafiles, ref_storage, kind):
repo_element_path = os.path.join(subproject_path, 'elements',
'import-etc-repo.bst')
- configure_project(project, {
+ update_project_configuration(project, {
'ref-storage': ref_storage
})
@@ -266,7 +267,7 @@ def test_track_include(cli, tmpdir, datafiles, ref_storage, kind):
element_path = os.path.join(project, 'elements')
element_name = 'track-test-{}.bst'.format(kind)
- configure_project(project, {
+ update_project_configuration(project, {
'ref-storage': ref_storage
})
@@ -338,7 +339,7 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind):
sub_element_path = os.path.join(subproject_path, 'elements')
junction_path = os.path.join(element_path, 'junction.bst')
- configure_project(project, {
+ update_project_configuration(project, {
'ref-storage': ref_storage
})
@@ -403,7 +404,7 @@ def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind):
subproject_path = os.path.join(project, 'files', 'sub-project')
junction_path = os.path.join(element_path, 'junction.bst')
- configure_project(project, {
+ update_project_configuration(project, {
'ref-storage': ref_storage,
'(@)': ['junction.bst:test.yml']
})
diff --git a/src/buildstream/testing/_utils/__init__.py b/src/buildstream/testing/_utils/__init__.py
index 575226e22..5938e6a5e 100644
--- a/src/buildstream/testing/_utils/__init__.py
+++ b/src/buildstream/testing/_utils/__init__.py
@@ -1,10 +1 @@
-import os
-
-from buildstream import _yaml
from .junction import generate_junction
-
-
-def configure_project(path, config):
- config['name'] = 'test'
- config['element-path'] = 'elements'
- _yaml.roundtrip_dump(config, os.path.join(path, 'project.conf'))