summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2018-04-22 03:16:03 +0100
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-06-06 22:10:49 +0000
commita5ff465d9225ad894435f95ec03f6ee21968fcb1 (patch)
tree727d3dc771d7267840b02cdb589a4d0bd358c726 /tests
parent7df956547696092cb07082bc4f6ec12f6585cdd0 (diff)
downloadbuildstream-a5ff465d9225ad894435f95ec03f6ee21968fcb1.tar.gz
_project.py: Allow running bst commands from subdirectories of project root
When initializing the project, BuildStream will continue searching for project.conf in parent directories in case it is not found in the current directory. Fixes #368.
Diffstat (limited to 'tests')
-rw-r--r--tests/format/project.py15
-rw-r--r--tests/format/project/project-from-subdir/manual.bst1
-rw-r--r--tests/format/project/project-from-subdir/project.conf4
-rw-r--r--tests/format/project/project-from-subdir/subdirectory/README1
4 files changed, 21 insertions, 0 deletions
diff --git a/tests/format/project.py b/tests/format/project.py
index b8e411351..9d595981b 100644
--- a/tests/format/project.py
+++ b/tests/format/project.py
@@ -55,6 +55,21 @@ def test_load_default_project(cli, datafiles):
@pytest.mark.datafiles(os.path.join(DATA_DIR))
+def test_load_project_from_subdir(cli, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename, 'project-from-subdir')
+ result = cli.run(
+ project=project,
+ cwd=os.path.join(project, 'subdirectory'),
+ args=['show', '--format', '%{env}', 'manual.bst'])
+ result.assert_success()
+
+ # Read back some of our project defaults from the env
+ env = _yaml.load_data(result.output)
+ assert (env['USER'] == "tomjon")
+ assert (env['TERM'] == "dumb")
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_override_project_path(cli, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename, "overridepath")
result = cli.run(project=project, args=[
diff --git a/tests/format/project/project-from-subdir/manual.bst b/tests/format/project/project-from-subdir/manual.bst
new file mode 100644
index 000000000..4d7f70266
--- /dev/null
+++ b/tests/format/project/project-from-subdir/manual.bst
@@ -0,0 +1 @@
+kind: manual
diff --git a/tests/format/project/project-from-subdir/project.conf b/tests/format/project/project-from-subdir/project.conf
new file mode 100644
index 000000000..fd3134c58
--- /dev/null
+++ b/tests/format/project/project-from-subdir/project.conf
@@ -0,0 +1,4 @@
+# Basic project configuration that doesnt override anything
+#
+
+name: pony
diff --git a/tests/format/project/project-from-subdir/subdirectory/README b/tests/format/project/project-from-subdir/subdirectory/README
new file mode 100644
index 000000000..b32d37708
--- /dev/null
+++ b/tests/format/project/project-from-subdir/subdirectory/README
@@ -0,0 +1 @@
+This directory is used to test running commands from a project subdirectory.