summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-02-27 22:13:59 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-02-28 00:03:04 +0900
commit1b74422ad9d150f2a6fa6473da5abd0f38949088 (patch)
tree15f410417a916178a4814752af0579ac92fe63a4
parentc9db2eb93183b73806b8d207af671bbeddc76f89 (diff)
downloadbuildstream-1b74422ad9d150f2a6fa6473da5abd0f38949088.tar.gz
tests/integration/shell.py: Generate project.conf on the fly
-rw-r--r--tests/integration/project/project.conf7
-rw-r--r--tests/integration/shell.py28
2 files changed, 28 insertions, 7 deletions
diff --git a/tests/integration/project/project.conf b/tests/integration/project/project.conf
index 3aae4fd0e..a677129fb 100644
--- a/tests/integration/project/project.conf
+++ b/tests/integration/project/project.conf
@@ -14,10 +14,3 @@ split-rules:
test:
- |
/tests/*
-
-# Allow inheriting a host environment variable
-# in `bst shell` for the shell test
-#
-shell:
- environment-inherit:
- - ANIMAL
diff --git a/tests/integration/shell.py b/tests/integration/shell.py
index 8c47d7718..18f2968fd 100644
--- a/tests/integration/shell.py
+++ b/tests/integration/shell.py
@@ -15,6 +15,24 @@ DATA_DIR = os.path.join(
)
+def create_project_conf(project_dir, config):
+ project_file = os.path.join(project_dir, 'project.conf')
+ config['name'] = 'test'
+ config['element-path'] = 'elements'
+ config['aliases'] = {
+ 'gnome7': 'https://gnome7.codethink.co.uk/',
+ 'project_dir': 'file://{}'.format(project_dir),
+ }
+ config['options'] = {
+ 'linux': {
+ 'type': 'bool',
+ 'description': 'Whether to expect a linux platform',
+ 'default': 'True'
+ }
+ }
+ _yaml.dump(config, project_file)
+
+
# execute_shell()
#
# Helper to run `bst shell` and first ensure that the element is built
@@ -65,6 +83,11 @@ def test_executable(cli, tmpdir, datafiles):
@pytest.mark.datafiles(DATA_DIR)
def test_inherit(cli, tmpdir, datafiles, animal):
project = os.path.join(datafiles.dirname, datafiles.basename)
+ create_project_conf(project, {
+ 'shell': {
+ 'environment-inherit': ['ANIMAL']
+ }
+ })
# Set the env var, and expect the same with added newline
os.environ['ANIMAL'] = animal
@@ -80,6 +103,11 @@ def test_inherit(cli, tmpdir, datafiles, animal):
@pytest.mark.datafiles(DATA_DIR)
def test_isolated_no_inherit(cli, tmpdir, datafiles, animal):
project = os.path.join(datafiles.dirname, datafiles.basename)
+ create_project_conf(project, {
+ 'shell': {
+ 'environment-inherit': ['ANIMAL']
+ }
+ })
# Set the env var, but expect that it is not applied
os.environ['ANIMAL'] = animal