From 3471d122c45b6056ba20b46f7995c9f61affb954 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sat, 31 Aug 2019 16:05:48 +0300 Subject: tests/loader/dependencies.py: Test errors when explicitly setting strict to True --- tests/loader/dependencies.py | 11 +++++++++++ tests/loader/dependencies/elements/invalidnonstrict.bst | 10 ++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/loader/dependencies/elements/invalidnonstrict.bst diff --git a/tests/loader/dependencies.py b/tests/loader/dependencies.py index 1a8365259..e4b9c73ed 100644 --- a/tests/loader/dependencies.py +++ b/tests/loader/dependencies.py @@ -134,6 +134,17 @@ def test_invalid_strict_dependency(cli, datafiles): assert (exc.value.reason == LoadErrorReason.INVALID_DATA) +@pytest.mark.datafiles(DATA_DIR) +def test_invalid_non_strict_dependency(cli, datafiles): + basedir = os.path.join(datafiles.dirname, datafiles.basename) + loader = make_loader(basedir) + + with pytest.raises(LoadError) as exc: + element = loader.load(['elements/invalidnonstrict.bst'])[0] + + assert (exc.value.reason == LoadErrorReason.INVALID_DATA) + + @pytest.mark.datafiles(DATA_DIR) def test_build_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) diff --git a/tests/loader/dependencies/elements/invalidnonstrict.bst b/tests/loader/dependencies/elements/invalidnonstrict.bst new file mode 100644 index 000000000..3cb31a077 --- /dev/null +++ b/tests/loader/dependencies/elements/invalidnonstrict.bst @@ -0,0 +1,10 @@ +kind: manual +description: | + + This is an invalid non strict dependency because it is + currently illegal to explicitly set a dependency to be + non-strict (even though this is the default). + +depends: +- filename: firstdep.bst + strict: false -- cgit v1.2.1