summaryrefslogtreecommitdiff
path: root/tests/loader/basics.py
diff options
context:
space:
mode:
authorFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2018-06-28 11:35:57 +0100
committerFrancisco Redondo Marchena <francisco.marchena@codethink.co.uk>2018-06-28 15:18:10 +0100
commit463698ec3203190aeac1f41ed3885f08e95bceae (patch)
tree1e7cf80f19e1c8b01017437e0c99487297ca8098 /tests/loader/basics.py
parent91d87e3c901dd9ac2cd3e7d148e5313cc5b915b0 (diff)
downloadbuildstream-463698ec3203190aeac1f41ed3885f08e95bceae.tar.gz
Add error message when running commands on directories
Issue #446
Diffstat (limited to 'tests/loader/basics.py')
-rw-r--r--tests/loader/basics.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/loader/basics.py b/tests/loader/basics.py
index 008750f70..3526697c5 100644
--- a/tests/loader/basics.py
+++ b/tests/loader/basics.py
@@ -84,3 +84,15 @@ def test_invalid_key(datafiles):
element = loader.load()[0]
assert (exc.value.reason == LoadErrorReason.INVALID_DATA)
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile'))
+def test_invalid_directory_load(datafiles):
+
+ basedir = os.path.join(datafiles.dirname, datafiles.basename)
+ loader = make_loader(basedir, ['elements/'])
+
+ with pytest.raises(LoadError) as exc:
+ element = loader.load()[0]
+
+ assert (exc.value.reason == LoadErrorReason.LOADING_DIRECTORY)