diff options
author | Tristan Maat <tristan.maat@codethink.co.uk> | 2017-10-31 15:41:42 +0000 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-11-04 17:35:30 +0900 |
commit | 44b89d8c3418f415d9306743ec7849155ee46838 (patch) | |
tree | 032a2d787e706afb64f64eb8af7e489ab36150ac /tests/loader | |
parent | 1fedde82a0022d134c0f8f5f44bfa7896ff51d4f (diff) | |
download | buildstream-44b89d8c3418f415d9306743ec7849155ee46838.tar.gz |
Adjust tests to new API
Diffstat (limited to 'tests/loader')
-rw-r--r-- | tests/loader/arches.py | 24 | ||||
-rw-r--r-- | tests/loader/basics.py | 22 | ||||
-rw-r--r-- | tests/loader/dependencies.py | 40 |
3 files changed, 43 insertions, 43 deletions
diff --git a/tests/loader/arches.py b/tests/loader/arches.py index 4106aec54..1f9d46367 100644 --- a/tests/loader/arches.py +++ b/tests/loader/arches.py @@ -20,9 +20,9 @@ def test_simple_conditional_nomatch(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/simple-conditional.bst', make_options(basedir), 'arm', None) + basedir, ['elements/simple-conditional.bst'], make_options(basedir), 'arm', None) - element = loader.load() + element = loader.load()[0] assert(isinstance(element, MetaElement)) number = element.config.get('number') @@ -35,9 +35,9 @@ def test_simple_conditional_x86_64(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/simple-conditional.bst', make_options(basedir), 'x86_64', None) + basedir, ['elements/simple-conditional.bst'], make_options(basedir), 'x86_64', None) - element = loader.load() + element = loader.load()[0] assert(isinstance(element, MetaElement)) number = element.config.get('number') @@ -50,9 +50,9 @@ def test_simple_conditional_x86_32(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/simple-conditional.bst', make_options(basedir), 'x86_32', None) + basedir, ['elements/simple-conditional.bst'], make_options(basedir), 'x86_32', None) - element = loader.load() + element = loader.load()[0] assert(isinstance(element, MetaElement)) number = element.config.get('number') @@ -70,9 +70,9 @@ def test_host_arch_conditional_armv8(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/host-arch-conditional.bst', make_options(basedir), 'armv8', None) + basedir, ['elements/host-arch-conditional.bst'], make_options(basedir), 'armv8', None) - element = loader.load() + element = loader.load()[0] assert(isinstance(element, MetaElement)) number = element.config.get('number') @@ -85,9 +85,9 @@ def test_host_arch_conditional_ignores_target_arch(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/host-arch-conditional.bst', make_options(basedir), 'armv8', 'x86_32') + basedir, ['elements/host-arch-conditional.bst'], make_options(basedir), 'armv8', 'x86_32') - element = loader.load() + element = loader.load()[0] assert(isinstance(element, MetaElement)) number = element.config.get('number') @@ -101,9 +101,9 @@ def test_host_arch_conditional_overridden(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/host-arch-conditional.bst', make_options(basedir), 'armv8', 'x86_64') + basedir, ['elements/host-arch-conditional.bst'], make_options(basedir), 'armv8', 'x86_64') - element = loader.load() + element = loader.load()[0] assert(isinstance(element, MetaElement)) number = element.config.get('number') diff --git a/tests/loader/basics.py b/tests/loader/basics.py index c85477898..1a891b775 100644 --- a/tests/loader/basics.py +++ b/tests/loader/basics.py @@ -19,9 +19,9 @@ DATA_DIR = os.path.join( def test_one_file(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/onefile.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/onefile.bst'], make_options(basedir), None, None) - element = loader.load() + element = loader.load()[0] assert(isinstance(element, MetaElement)) assert(element.kind == 'pony') @@ -31,10 +31,10 @@ def test_one_file(datafiles): def test_missing_file(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/missing.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/missing.bst'], make_options(basedir), None, None) with pytest.raises(LoadError) as exc: - element = loader.load() + element = loader.load()[0] assert (exc.value.reason == LoadErrorReason.MISSING_FILE) @@ -43,10 +43,10 @@ def test_missing_file(datafiles): def test_invalid_reference(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/badreference.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/badreference.bst'], make_options(basedir), None, None) with pytest.raises(LoadError) as exc: - element = loader.load() + element = loader.load()[0] assert (exc.value.reason == LoadErrorReason.INVALID_YAML) @@ -55,10 +55,10 @@ def test_invalid_reference(datafiles): def test_invalid_yaml(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/badfile.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/badfile.bst'], make_options(basedir), None, None) with pytest.raises(LoadError) as exc: - element = loader.load() + element = loader.load()[0] assert (exc.value.reason == LoadErrorReason.INVALID_YAML) @@ -70,7 +70,7 @@ def test_fail_fullpath_target(datafiles): fullpath = os.path.join(basedir, 'elements', 'onefile.bst') with pytest.raises(LoadError) as exc: - loader = Loader(basedir, fullpath, make_options(basedir), None, None) + loader = Loader(basedir, [fullpath], make_options(basedir), None, None) assert (exc.value.reason == LoadErrorReason.INVALID_DATA) @@ -79,9 +79,9 @@ def test_fail_fullpath_target(datafiles): def test_invalid_key(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/invalidkey.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/invalidkey.bst'], make_options(basedir), None, None) with pytest.raises(LoadError) as exc: - element = loader.load() + element = loader.load()[0] assert (exc.value.reason == LoadErrorReason.INVALID_DATA) diff --git a/tests/loader/dependencies.py b/tests/loader/dependencies.py index 3a4fee278..342af96ef 100644 --- a/tests/loader/dependencies.py +++ b/tests/loader/dependencies.py @@ -19,8 +19,8 @@ DATA_DIR = os.path.join( def test_two_files(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/target.bst', make_options(basedir), None, None) - element = loader.load() + loader = Loader(basedir, ['elements/target.bst'], make_options(basedir), None, None) + element = loader.load()[0] assert(isinstance(element, MetaElement)) assert(element.kind == 'pony') @@ -35,8 +35,8 @@ def test_two_files(datafiles): def test_shared_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/shareddeptarget.bst', make_options(basedir), None, None) - element = loader.load() + loader = Loader(basedir, ['elements/shareddeptarget.bst'], make_options(basedir), None, None) + element = loader.load()[0] # Toplevel is 'pony' with 2 dependencies # @@ -78,8 +78,8 @@ def test_shared_dependency(datafiles): def test_dependency_dict(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/target-depdict.bst', make_options(basedir), None, None) - element = loader.load() + loader = Loader(basedir, ['elements/target-depdict.bst'], make_options(basedir), None, None) + element = loader.load()[0] assert(isinstance(element, MetaElement)) assert(element.kind == 'pony') @@ -93,10 +93,10 @@ def test_dependency_dict(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_invalid_dependency_declaration(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/invaliddep.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/invaliddep.bst'], make_options(basedir), None, None) with pytest.raises(LoadError) as exc: - element = loader.load() + element = loader.load()[0] assert (exc.value.reason == LoadErrorReason.INVALID_DATA) @@ -104,10 +104,10 @@ def test_invalid_dependency_declaration(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_circular_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/circulartarget.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/circulartarget.bst'], make_options(basedir), None, None) with pytest.raises(LoadError) as exc: - element = loader.load() + element = loader.load()[0] assert (exc.value.reason == LoadErrorReason.CIRCULAR_DEPENDENCY) @@ -115,10 +115,10 @@ def test_circular_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_invalid_dependency_type(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/invaliddeptype.bst', make_options(basedir), None, None) + loader = Loader(basedir, ['elements/invaliddeptype.bst'], make_options(basedir), None, None) with pytest.raises(LoadError) as exc: - element = loader.load() + element = loader.load()[0] assert (exc.value.reason == LoadErrorReason.INVALID_DATA) @@ -126,8 +126,8 @@ def test_invalid_dependency_type(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/builddep.bst', make_options(basedir), None, None) - element = loader.load() + loader = Loader(basedir, ['elements/builddep.bst'], make_options(basedir), None, None) + element = loader.load()[0] assert(isinstance(element, MetaElement)) assert(element.kind == 'pony') @@ -142,8 +142,8 @@ def test_build_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_runtime_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/runtimedep.bst', make_options(basedir), None, None) - element = loader.load() + loader = Loader(basedir, ['elements/runtimedep.bst'], make_options(basedir), None, None) + element = loader.load()[0] assert(isinstance(element, MetaElement)) assert(element.kind == 'pony') @@ -158,8 +158,8 @@ def test_runtime_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_runtime_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/target.bst', make_options(basedir), None, None) - element = loader.load() + loader = Loader(basedir, ['elements/target.bst'], make_options(basedir), None, None) + element = loader.load()[0] assert(isinstance(element, MetaElement)) assert(element.kind == 'pony') @@ -175,8 +175,8 @@ def test_build_runtime_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_all_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/alldep.bst', make_options(basedir), None, None) - element = loader.load() + loader = Loader(basedir, ['elements/alldep.bst'], make_options(basedir), None, None) + element = loader.load()[0] assert(isinstance(element, MetaElement)) assert(element.kind == 'pony') |