summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-05 21:14:52 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-05 22:14:32 +0900
commit50af604e51c3cc325d7bbc60185b13d72c9fe634 (patch)
tree267ecadc7679c5bcc1291df6b2396b7055991186
parent857751fb6479afa0ee83d4759891f7c4837b87bb (diff)
downloadbuildstream-50af604e51c3cc325d7bbc60185b13d72c9fe634.tar.gz
tests/frontend: Share the configure_project() function
Make buildtrack.py and track.py share the same configure_project() helper.
-rw-r--r--tests/frontend/__init__.py10
-rw-r--r--tests/frontend/buildtrack.py7
-rw-r--r--tests/frontend/track.py8
3 files changed, 13 insertions, 12 deletions
diff --git a/tests/frontend/__init__.py b/tests/frontend/__init__.py
index e69de29bb..8cf7625a9 100644
--- a/tests/frontend/__init__.py
+++ b/tests/frontend/__init__.py
@@ -0,0 +1,10 @@
+import os
+from buildstream import _yaml
+
+
+# Shared function to configure the project.conf inline
+#
+def configure_project(path, config):
+ config['name'] = 'test'
+ config['element-path'] = 'elements'
+ _yaml.dump(config, os.path.join(path, 'project.conf'))
diff --git a/tests/frontend/buildtrack.py b/tests/frontend/buildtrack.py
index 64617b860..84d543e52 100644
--- a/tests/frontend/buildtrack.py
+++ b/tests/frontend/buildtrack.py
@@ -9,6 +9,7 @@ from tests.testutils import cli, create_repo
from buildstream import _yaml
from buildstream._exceptions import ErrorDomain
+from . import configure_project
# Project directory
DATA_DIR = os.path.join(
@@ -28,12 +29,6 @@ def create_element(repo, name, path, dependencies, ref=None):
_yaml.dump(element, os.path.join(path, name))
-def configure_project(path, config):
- config['name'] = 'test'
- config['element-path'] = 'elements'
- _yaml.dump(config, os.path.join(path, 'project.conf'))
-
-
@pytest.mark.datafiles(os.path.join(DATA_DIR))
@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
@pytest.mark.parametrize("exceptions,excepted", [
diff --git a/tests/frontend/track.py b/tests/frontend/track.py
index 62514cdd7..1425183be 100644
--- a/tests/frontend/track.py
+++ b/tests/frontend/track.py
@@ -5,6 +5,8 @@ from tests.testutils import cli, create_repo, ALL_REPO_KINDS
from buildstream._exceptions import ErrorDomain
from buildstream import _yaml
+from . import configure_project
+
# Project directory
TOP_DIR = os.path.dirname(os.path.realpath(__file__))
DATA_DIR = os.path.join(TOP_DIR, 'project')
@@ -23,12 +25,6 @@ def generate_element(repo, element_path, dep_name=None):
_yaml.dump(element, element_path)
-def configure_project(path, config):
- config['name'] = 'test'
- config['element-path'] = 'elements'
- _yaml.dump(config, os.path.join(path, 'project.conf'))
-
-
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])