summaryrefslogtreecommitdiff
path: root/tests/internals
diff options
context:
space:
mode:
authorTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-05-30 21:18:26 +0900
committerTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-05-30 21:22:58 +0900
commit49ab0bc22c66e12651ecc1fecd3511cfcd916b3e (patch)
treefac39a6e93d4834dbea5d38fce8514399dff60dd /tests/internals
parentf2a5dbe9f888d5b8a4fc4e6abd666fde722bc8f7 (diff)
downloadbuildstream-49ab0bc22c66e12651ecc1fecd3511cfcd916b3e.tar.gz
loader: removing the NO_PROGRESS objecttristan/remove-loader-no-progress-object
While adding a mock task object to track progress in some loader tests in commit 17144d84c2b63daf6e3aa9b42c6c773f134e8660, a new `_NO_PROGRESS` object was added as an explicit marker to denote that progress information should not be reported. This complicates the code, None should be a sufficient value for not reporting progress, while still permitting mock task objects to capture progress if desired.
Diffstat (limited to 'tests/internals')
-rw-r--r--tests/internals/loader.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/internals/loader.py b/tests/internals/loader.py
index 6fdd9fc3a..408813a64 100644
--- a/tests/internals/loader.py
+++ b/tests/internals/loader.py
@@ -6,7 +6,6 @@ from buildstream.exceptions import LoadErrorReason
from buildstream._exceptions import LoadError
from buildstream._project import Project
from buildstream._loader import MetaElement
-from buildstream._loader.loader import _NO_PROGRESS
from tests.testutils import dummy_context
@@ -29,7 +28,7 @@ def test_one_file(datafiles):
basedir = str(datafiles)
with make_loader(basedir) as loader:
- element = loader.load(["elements/onefile.bst"], _NO_PROGRESS)[0]
+ element = loader.load(["elements/onefile.bst"], None)[0]
assert isinstance(element, MetaElement)
assert element.kind == "pony"
@@ -40,7 +39,7 @@ def test_missing_file(datafiles):
basedir = str(datafiles)
with make_loader(basedir) as loader, pytest.raises(LoadError) as exc:
- loader.load(["elements/missing.bst"], _NO_PROGRESS)
+ loader.load(["elements/missing.bst"], None)
assert exc.value.reason == LoadErrorReason.MISSING_FILE
@@ -50,7 +49,7 @@ def test_invalid_reference(datafiles):
basedir = str(datafiles)
with make_loader(basedir) as loader, pytest.raises(LoadError) as exc:
- loader.load(["elements/badreference.bst"], _NO_PROGRESS)
+ loader.load(["elements/badreference.bst"], None)
assert exc.value.reason == LoadErrorReason.INVALID_YAML
@@ -60,7 +59,7 @@ def test_invalid_yaml(datafiles):
basedir = str(datafiles)
with make_loader(basedir) as loader, pytest.raises(LoadError) as exc:
- loader.load(["elements/badfile.bst"], _NO_PROGRESS)
+ loader.load(["elements/badfile.bst"], None)
assert exc.value.reason == LoadErrorReason.INVALID_YAML
@@ -72,7 +71,7 @@ def test_fail_fullpath_target(datafiles):
fullpath = os.path.join(basedir, "elements", "onefile.bst")
with make_loader(basedir) as loader, pytest.raises(LoadError) as exc:
- loader.load([fullpath], _NO_PROGRESS)
+ loader.load([fullpath], None)
assert exc.value.reason == LoadErrorReason.INVALID_DATA
@@ -82,7 +81,7 @@ def test_invalid_key(datafiles):
basedir = str(datafiles)
with make_loader(basedir) as loader, pytest.raises(LoadError) as exc:
- loader.load(["elements/invalidkey.bst"], _NO_PROGRESS)
+ loader.load(["elements/invalidkey.bst"], None)
assert exc.value.reason == LoadErrorReason.INVALID_DATA
@@ -92,6 +91,6 @@ def test_invalid_directory_load(datafiles):
basedir = str(datafiles)
with make_loader(basedir) as loader, pytest.raises(LoadError) as exc:
- loader.load(["elements/"], _NO_PROGRESS)
+ loader.load(["elements/"], None)
assert exc.value.reason == LoadErrorReason.LOADING_DIRECTORY