summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/loader/arches.py24
-rw-r--r--tests/loader/basics.py22
-rw-r--r--tests/loader/dependencies.py40
-rw-r--r--tests/pipeline/load.py42
-rw-r--r--tests/plugins/pipeline.py6
-rw-r--r--tests/project/plugins.py4
-rw-r--r--tests/sources/fixture.py4
-rw-r--r--tests/variables/variables.py6
8 files changed, 74 insertions, 74 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')
diff --git a/tests/pipeline/load.py b/tests/pipeline/load.py
index 33d49bb31..90b19ee7e 100644
--- a/tests/pipeline/load.py
+++ b/tests/pipeline/load.py
@@ -21,7 +21,7 @@ def create_pipeline(tmpdir, basedir, target):
context.artifactdir = os.path.join(str(tmpdir), 'artifact')
context._platform = Platform.get_platform()
- return Pipeline(context, project, target)
+ return Pipeline(context, project, [target])
@pytest.mark.skipif(not HAVE_ROOT, reason="requires root permissions")
@@ -31,10 +31,10 @@ def test_load_simple(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'simple.bst')
- assert(pipeline.target.get_kind() == "autotools")
+ assert(pipeline.targets[0].get_kind() == "autotools")
- assert(isinstance(pipeline.target.commands['configure-commands'], list))
- command_list = pipeline.target.commands['configure-commands']
+ assert(isinstance(pipeline.targets[0].commands['configure-commands'], list))
+ command_list = pipeline.targets[0].commands['configure-commands']
assert(len(command_list) == 1)
assert(command_list[0] == 'pony')
@@ -49,14 +49,14 @@ def test_iterate_scope_all(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'target.bst')
- assert(pipeline.target.get_kind() == "autotools")
+ assert(pipeline.targets[0].get_kind() == "autotools")
- assert(isinstance(pipeline.target.commands['configure-commands'], list))
- command_list = pipeline.target.commands['configure-commands']
+ assert(isinstance(pipeline.targets[0].commands['configure-commands'], list))
+ command_list = pipeline.targets[0].commands['configure-commands']
assert(len(command_list) == 1)
assert(command_list[0] == 'pony')
- element_list = pipeline.target.dependencies(Scope.ALL)
+ element_list = pipeline.targets[0].dependencies(Scope.ALL)
element_list = list(element_list)
assert(len(element_list) == 7)
@@ -76,14 +76,14 @@ def test_iterate_scope_run(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'target.bst')
- assert(pipeline.target.get_kind() == "autotools")
+ assert(pipeline.targets[0].get_kind() == "autotools")
- assert(isinstance(pipeline.target.commands['configure-commands'], list))
- command_list = pipeline.target.commands['configure-commands']
+ assert(isinstance(pipeline.targets[0].commands['configure-commands'], list))
+ command_list = pipeline.targets[0].commands['configure-commands']
assert(len(command_list) == 1)
assert(command_list[0] == 'pony')
- element_list = pipeline.target.dependencies(Scope.RUN)
+ element_list = pipeline.targets[0].dependencies(Scope.RUN)
element_list = list(element_list)
assert(len(element_list) == 4)
@@ -100,14 +100,14 @@ def test_iterate_scope_build(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'target.bst')
- assert(pipeline.target.get_kind() == "autotools")
+ assert(pipeline.targets[0].get_kind() == "autotools")
- assert(isinstance(pipeline.target.commands['configure-commands'], list))
- command_list = pipeline.target.commands['configure-commands']
+ assert(isinstance(pipeline.targets[0].commands['configure-commands'], list))
+ command_list = pipeline.targets[0].commands['configure-commands']
assert(len(command_list) == 1)
assert(command_list[0] == 'pony')
- element_list = pipeline.target.dependencies(Scope.BUILD)
+ element_list = pipeline.targets[0].dependencies(Scope.BUILD)
element_list = list(element_list)
assert(len(element_list) == 3)
@@ -124,15 +124,15 @@ def test_iterate_scope_build_of_child(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'target.bst')
- assert(pipeline.target.get_kind() == "autotools")
+ assert(pipeline.targets[0].get_kind() == "autotools")
- assert(isinstance(pipeline.target.commands['configure-commands'], list))
- command_list = pipeline.target.commands['configure-commands']
+ assert(isinstance(pipeline.targets[0].commands['configure-commands'], list))
+ command_list = pipeline.targets[0].commands['configure-commands']
assert(len(command_list) == 1)
assert(command_list[0] == 'pony')
# First pass, lets check dep-two
- element_list = pipeline.target.dependencies(Scope.BUILD)
+ element_list = pipeline.targets[0].dependencies(Scope.BUILD)
element_list = list(element_list)
element = element_list[2]
@@ -158,7 +158,7 @@ def test_remove_elements(datafiles, tmpdir):
# Remove second-level-2 and check that the correct dependencies
# are removed.
- element_list = pipeline.target.dependencies(Scope.ALL)
+ element_list = pipeline.targets[0].dependencies(Scope.ALL)
element_list = pipeline.remove_elements(element_list, ['second-level-1.bst'])
assert(set(e.name for e in element_list) ==
diff --git a/tests/plugins/pipeline.py b/tests/plugins/pipeline.py
index 1ff248178..9f5e94ae9 100644
--- a/tests/plugins/pipeline.py
+++ b/tests/plugins/pipeline.py
@@ -21,7 +21,7 @@ def create_pipeline(tmpdir, basedir, target):
context.artifactdir = os.path.join(str(tmpdir), 'artifact')
context._platform = Platform.get_platform()
- return Pipeline(context, project, target)
+ return Pipeline(context, project, [target])
@pytest.mark.skipif(not HAVE_ROOT, reason="requires root permissions")
@@ -30,7 +30,7 @@ def test_customsource(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'simple.bst')
- assert(pipeline.target.get_kind() == "autotools")
+ assert(pipeline.targets[0].get_kind() == "autotools")
@pytest.mark.skipif(not HAVE_ROOT, reason="requires root permissions")
@@ -39,7 +39,7 @@ def test_customelement(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'simple.bst')
- assert(pipeline.target.get_kind() == "foo")
+ assert(pipeline.targets[0].get_kind() == "foo")
@pytest.mark.skipif(not HAVE_ROOT, reason="requires root permissions")
diff --git a/tests/project/plugins.py b/tests/project/plugins.py
index 67dc691d7..fd90de9aa 100644
--- a/tests/project/plugins.py
+++ b/tests/project/plugins.py
@@ -19,7 +19,7 @@ def create_pipeline(tmpdir, basedir, target):
context.artifactdir = os.path.join(str(tmpdir), 'artifact')
context._platform = Platform.get_platform()
- return Pipeline(context, project, target)
+ return Pipeline(context, project, [target])
# We've already validated that the plugin system works in
@@ -35,7 +35,7 @@ def test_custom_element(datafiles, tmpdir):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, 'custom.bst')
- element = pipeline.target
+ element = pipeline.targets[0]
assert(len(element._Element__sources) > 0)
source = element._Element__sources[0]
diff --git a/tests/sources/fixture.py b/tests/sources/fixture.py
index 89e03cb8e..3438fe3a6 100644
--- a/tests/sources/fixture.py
+++ b/tests/sources/fixture.py
@@ -35,8 +35,8 @@ class Setup():
if not os.path.exists(self.context.builddir):
os.mkdir(self.context.builddir)
- loader = Loader(directory, target, self.project._options, None, None)
- element = loader.load()
+ loader = Loader(directory, [target], self.project._options, None, None)
+ element = loader.load()[0]
# Allow repo aliases to access files in the directories using tmpdir and datafiles
self.project._aliases['tmpdir'] = "file:///" + str(tmpdir)
diff --git a/tests/variables/variables.py b/tests/variables/variables.py
index 8c5db0a19..d6855591e 100644
--- a/tests/variables/variables.py
+++ b/tests/variables/variables.py
@@ -18,15 +18,15 @@ def create_pipeline(tmpdir, basedir, target):
context.artifactdir = os.path.join(str(tmpdir), 'artifact')
context._platform = Platform.get_platform()
- return Pipeline(context, project, target)
+ return Pipeline(context, project, [target])
def assert_command(datafiles, tmpdir, target, command, expected):
basedir = os.path.join(datafiles.dirname, datafiles.basename)
pipeline = create_pipeline(tmpdir, basedir, target)
- assert(isinstance(pipeline.target, BuildElement))
+ assert(isinstance(pipeline.targets[0], BuildElement))
- commands = pipeline.target.commands
+ commands = pipeline.targets[0].commands
assert(commands.get(command) is not None)
assert(len(commands[command]) > 0)