diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2018-07-31 18:21:10 +0100 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2018-08-02 12:33:17 +0100 |
commit | 5f3faa08b0583055cfedfdbf0a2447a345196779 (patch) | |
tree | e0c4270ab9fcb0b28738bab8f9c71414591fd95d | |
parent | 29a70806ff1ae7269f4b2ef8307cf7eb769f823b (diff) | |
download | buildstream-tiagogomes/issue-195-1.2.tar.gz |
tests: test local plugins and element-path pathstiagogomes/issue-195-1.2
-rw-r--r-- | tests/format/project.py | 44 | ||||
-rw-r--r-- | tests/format/project/element-path/project.conf | 2 | ||||
-rw-r--r-- | tests/format/project/local-plugin/project.conf | 6 |
3 files changed, 51 insertions, 1 deletions
diff --git a/tests/format/project.py b/tests/format/project.py index 9d595981b..df1a2364b 100644 --- a/tests/format/project.py +++ b/tests/format/project.py @@ -2,7 +2,7 @@ import os import pytest from buildstream import _yaml from buildstream._exceptions import ErrorDomain, LoadErrorReason -from tests.testutils.runcli import cli +from tests.testutils import cli, filetypegenerator # Project directory @@ -90,6 +90,48 @@ def test_project_unsupported(cli, datafiles): result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.UNSUPPORTED_PROJECT) +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'element-path')) +def test_missing_element_path_directory(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + result = cli.run(project=project, args=['workspace', 'list']) + result.assert_main_error(ErrorDomain.LOAD, + LoadErrorReason.MISSING_FILE) + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'element-path')) +def test_element_path_not_a_directory(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + path = os.path.join(project, 'elements') + for file_type in filetypegenerator.generate_file_types(path): + result = cli.run(project=project, args=['workspace', 'list']) + if not os.path.isdir(path): + result.assert_main_error(ErrorDomain.LOAD, + LoadErrorReason.PROJ_PATH_INVALID_KIND) + else: + result.assert_success() + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'local-plugin')) +def test_missing_local_plugin_directory(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + result = cli.run(project=project, args=['workspace', 'list']) + result.assert_main_error(ErrorDomain.LOAD, + LoadErrorReason.MISSING_FILE) + + +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'local-plugin')) +def test_local_plugin_not_directory(cli, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + path = os.path.join(project, 'plugins') + for file_type in filetypegenerator.generate_file_types(path): + result = cli.run(project=project, args=['workspace', 'list']) + if not os.path.isdir(path): + result.assert_main_error(ErrorDomain.LOAD, + LoadErrorReason.PROJ_PATH_INVALID_KIND) + else: + result.assert_success() + + @pytest.mark.datafiles(DATA_DIR) def test_project_plugin_load_allowed(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename, 'plugin-allowed') diff --git a/tests/format/project/element-path/project.conf b/tests/format/project/element-path/project.conf new file mode 100644 index 000000000..57e87de4f --- /dev/null +++ b/tests/format/project/element-path/project.conf @@ -0,0 +1,2 @@ +name: foo +element-path: elements diff --git a/tests/format/project/local-plugin/project.conf b/tests/format/project/local-plugin/project.conf new file mode 100644 index 000000000..97166e350 --- /dev/null +++ b/tests/format/project/local-plugin/project.conf @@ -0,0 +1,6 @@ +name: foo +plugins: +- origin: local + path: plugins + sources: + mysource: 0 |