summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-08-25 10:00:32 +0200
committerJürg Billeter <j@bitron.ch>2020-09-03 11:08:12 +0200
commit8d006f8f17ad35f61f69101fe1531564d8d8a688 (patch)
tree54bda91ae159cc592e844131fad3670763d0e734
parentade3c1636b9ff34b724cdb572e233c79e1e97557 (diff)
downloadbuildstream-8d006f8f17ad35f61f69101fe1531564d8d8a688.tar.gz
tests/sourcecache: Do not inspect uninitialized elements
-rw-r--r--tests/sourcecache/fetch.py5
-rw-r--r--tests/sourcecache/push.py2
-rw-r--r--tests/sourcecache/staging.py3
3 files changed, 10 insertions, 0 deletions
diff --git a/tests/sourcecache/fetch.py b/tests/sourcecache/fetch.py
index 1e54a98a5..ac8c6258f 100644
--- a/tests/sourcecache/fetch.py
+++ b/tests/sourcecache/fetch.py
@@ -74,6 +74,7 @@ def test_source_fetch(cli, tmpdir, datafiles):
project.ensure_fully_loaded()
element = project.load_elements([element_name])[0]
+ element._initialize_state()
assert not element._has_all_sources_in_source_cache()
source = list(element.sources())[0]
@@ -113,6 +114,7 @@ def test_source_fetch(cli, tmpdir, datafiles):
project.ensure_fully_loaded()
element = project.load_elements([element_name])[0]
+ element._initialize_state()
# check that we have the source in the cas now and it's not fetched
assert element._has_all_sources_in_source_cache()
@@ -132,6 +134,7 @@ def test_fetch_fallback(cli, tmpdir, datafiles):
project.ensure_fully_loaded()
element = project.load_elements([element_name])[0]
+ element._initialize_state()
assert not element._has_all_sources_in_source_cache()
source = list(element.sources())[0]
@@ -163,6 +166,7 @@ def test_pull_fail(cli, tmpdir, datafiles):
project.ensure_fully_loaded()
element = project.load_elements([element_name])[0]
+ element._initialize_state()
assert not element._has_all_sources_in_source_cache()
source = list(element.sources())[0]
@@ -194,6 +198,7 @@ def test_source_pull_partial_fallback_fetch(cli, tmpdir, datafiles):
project.ensure_fully_loaded()
element = project.load_elements([element_name])[0]
+ element._initialize_state()
assert not element._has_all_sources_in_source_cache()
source = list(element.sources())[0]
diff --git a/tests/sourcecache/push.py b/tests/sourcecache/push.py
index 902ae943d..b1aa8a375 100644
--- a/tests/sourcecache/push.py
+++ b/tests/sourcecache/push.py
@@ -84,6 +84,7 @@ def test_source_push_split(cli, tmpdir, datafiles):
project.ensure_fully_loaded()
element = project.load_elements(["push.bst"])[0]
+ element._initialize_state()
assert not element._has_all_sources_in_source_cache()
source = list(element.sources())[0]
@@ -133,6 +134,7 @@ def test_source_push(cli, tmpdir, datafiles):
project.ensure_fully_loaded()
element = project.load_elements(["push.bst"])[0]
+ element._initialize_state()
assert not element._has_all_sources_in_source_cache()
source = list(element.sources())[0]
diff --git a/tests/sourcecache/staging.py b/tests/sourcecache/staging.py
index dbfc028f2..bfde1b436 100644
--- a/tests/sourcecache/staging.py
+++ b/tests/sourcecache/staging.py
@@ -64,6 +64,7 @@ def test_source_staged(tmpdir, cli, datafiles):
# now check that the source is in the refs file, this is pretty messy but
# seems to be the only way to get the sources?
element = project.load_elements(["import-bin.bst"])[0]
+ element._initialize_state()
source = list(element.sources())[0]
assert element._has_all_sources_in_source_cache()
assert sourcecache.contains(source)
@@ -98,6 +99,7 @@ def test_source_fetch(tmpdir, cli, datafiles):
sourcecache = context.sourcecache
element = project.load_elements(["import-dev.bst"])[0]
+ element._initialize_state()
source = list(element.sources())[0]
assert element._has_all_sources_in_source_cache()
@@ -130,6 +132,7 @@ def test_staged_source_build(tmpdir, datafiles, cli):
project.ensure_fully_loaded()
element = project.load_elements(["import-dev.bst"])[0]
+ element._initialize_state()
# check consistency of the source
assert not element._has_all_sources_in_source_cache()