Phillip Smyth pushed to branch master at BuildStream / buildstream
Commits:
-
ba4da3a4
by knownexus at 2018-09-18T16:45:09Z
-
89a16e17
by knownexus at 2018-09-18T16:45:09Z
-
72b59021
by Phillip Smyth at 2018-09-19T08:48:51Z
4 changed files:
- buildstream/_project.py
- tests/format/project.py
- + tests/format/project/invalid-yaml/manual.bst
- + tests/format/project/invalid-yaml/project.conf
Changes:
... | ... | @@ -385,7 +385,10 @@ class Project(): |
385 | 385 |
self._project_conf = _yaml.load(projectfile)
|
386 | 386 |
except LoadError as e:
|
387 | 387 |
# Raise a more specific error here
|
388 |
- raise LoadError(LoadErrorReason.MISSING_PROJECT_CONF, str(e))
|
|
388 |
+ if e.reason == LoadErrorReason.MISSING_FILE:
|
|
389 |
+ raise LoadError(LoadErrorReason.MISSING_PROJECT_CONF, str(e)) from e
|
|
390 |
+ else:
|
|
391 |
+ raise
|
|
389 | 392 |
|
390 | 393 |
pre_config_node = _yaml.node_copy(self._default_config_node)
|
391 | 394 |
_yaml.composite(pre_config_node, self._project_conf)
|
... | ... | @@ -40,6 +40,13 @@ def test_invalid_project_name(cli, datafiles): |
40 | 40 |
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_SYMBOL_NAME)
|
41 | 41 |
|
42 | 42 |
|
43 |
+@pytest.mark.datafiles(os.path.join(DATA_DIR))
|
|
44 |
+def test_invalid_yaml(cli, datafiles):
|
|
45 |
+ project = os.path.join(datafiles.dirname, datafiles.basename, "invalid-yaml")
|
|
46 |
+ result = cli.run(project=project, args=['workspace', 'list'])
|
|
47 |
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_YAML)
|
|
48 |
+ |
|
49 |
+ |
|
43 | 50 |
@pytest.mark.datafiles(os.path.join(DATA_DIR))
|
44 | 51 |
def test_load_default_project(cli, datafiles):
|
45 | 52 |
project = os.path.join(datafiles.dirname, datafiles.basename, "default")
|
1 |
+kind: manual
|
1 |
+# Basic project configuration that doesnt override anything
|
|
2 |
+#
|
|
3 |
+ |
|
4 |
+name: pony
|
|
5 |
+ |
|
6 |
+variables:
|
|
7 |
+ sbindir: "%{bindir}
|
|
8 |
+ |