summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-08-10 19:41:10 +0900
committerTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-08-13 16:38:33 +0900
commit898fde9effcfc8dd632a6bdb731e3b73e438656c (patch)
tree5a3f2d18d95e58f39c82f955d5e36fb8b47f0b6c /tests
parent830401ba6abbced060ceb5e833a5a76fea39a743 (diff)
downloadbuildstream-898fde9effcfc8dd632a6bdb731e3b73e438656c.tar.gz
Completely remove MetaElement
This dramatically affects the load process and removes one hoop we had to jump through, which is the creation of the extra intermediate MetaElement objects. This allows us to more easily carry state discovered by the Loader over to the Element constructor, as we need not add additional state to the intermediate MetaElement for this. Instead we have the Element initializer understand the LoadElement directly. Summary of changes: * _loader/metaelement.py: Removed * _loader/loadelement.py: Added some attributes previously required on MetaElement * _loader/loader.py: Removed _collect_element() and collect_element_no_deps(), removing the process of Loader.load() which translates LoadElements into MetaElements completely. * _loader/init.py: Export LoadElement, Dependency and Symbol types, stop exporting MetaElement * _loader/metasource.py: Now take the 'first_pass' parameter as an argument * _artifactelement.py: Use a virtual LoadElement instead of a virtual MetaElement to instantiate the ArtifactElement objects. * _pluginfactory/elementfactory.py: Adjust to now take a LoadElement * _project.py: Adjust Project.create_element() to now take a LoadElement, and call the new Element._new_from_load_element() instead of the old Element._new_from_meta() function * element.py: - Now export Element._new_from_load_element() instead of Element._new_from_meta() - Adjust the constructor to do the LoadElement toplevel node parsing instead of expecting members on the MetaElement object - Added __load_sources() which parses out and creates MetaSource objects for the sake of instantiating the element's Source objects. Consequently this simplifies the scenario where workspaces are involved. * source.py: Adjusted to use the new `first_pass` parameter to MetaSource when creating a duplicate clone.
Diffstat (limited to 'tests')
-rw-r--r--tests/internals/loader.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/internals/loader.py b/tests/internals/loader.py
index bdce428f0..2da01723b 100644
--- a/tests/internals/loader.py
+++ b/tests/internals/loader.py
@@ -5,7 +5,7 @@ import pytest
from buildstream.exceptions import LoadErrorReason
from buildstream._exceptions import LoadError
from buildstream._project import Project
-from buildstream._loader import MetaElement
+from buildstream._loader import LoadElement
from tests.testutils import dummy_context
@@ -30,7 +30,7 @@ def test_one_file(datafiles):
with make_loader(basedir) as loader:
element = loader.load(["elements/onefile.bst"])[0]
- assert isinstance(element, MetaElement)
+ assert isinstance(element, LoadElement)
assert element.kind == "pony"