You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:45:34 UTC
[buildstream] 01/06: tests/frontend: Assert cached state in a
single line
This is an automated email from the ASF dual-hosted git repository.
root pushed a commit to branch tristan/multiple-caches
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit f4c007e034ff2fbbc9120ae106d53b1ec2dc0f87
Author: Sam Thursfield <sa...@codethink.co.uk>
AuthorDate: Wed Nov 29 11:48:19 2017 +0000
tests/frontend: Assert cached state in a single line
Minor tweak to hopefully make the test cases a bit shorter and more
readable, in preparation for adding more.
---
tests/frontend/pull.py | 18 ++++++------------
tests/frontend/push.py | 6 ++----
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py
index 530c1e0..5f06e55 100644
--- a/tests/frontend/pull.py
+++ b/tests/frontend/pull.py
@@ -43,8 +43,7 @@ def test_push_pull(cli, tmpdir, datafiles, override_url, project_url, user_url):
result.assert_success()
# Assert that we are now cached locally
- state = cli.get_element_state(project, 'import-bin.bst')
- assert state == 'cached'
+ assert cli.get_element_state(project, 'import-bin.bst') == 'cached'
override_url = share.repo if override_url == 'share.repo' else override_url
project_url = share.repo if project_url == 'share.repo' else project_url
@@ -94,16 +93,14 @@ def test_push_pull(cli, tmpdir, datafiles, override_url, project_url, user_url):
# Assert that we are now in a downloadable state, nothing
# is cached locally anymore
- state = cli.get_element_state(project, 'import-bin.bst')
- assert state == 'downloadable'
+ assert cli.get_element_state(project, 'import-bin.bst') == 'downloadable'
# Now try bst pull
result = cli.run(project=project, args=['pull', 'import-bin.bst'])
result.assert_success()
# And assert that it's again in the local cache, without having built
- state = cli.get_element_state(project, 'import-bin.bst')
- assert state == 'cached'
+ assert cli.get_element_state(project, 'import-bin.bst') == 'cached'
@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
@@ -117,8 +114,7 @@ def test_push_pull_all(cli, tmpdir, datafiles):
result.assert_success()
# Assert that we are now cached locally
- state = cli.get_element_state(project, 'target.bst')
- assert state == 'cached'
+ assert cli.get_element_state(project, 'target.bst') == 'cached'
# Configure artifact share
cli.configure({
@@ -161,8 +157,7 @@ def test_push_pull_all(cli, tmpdir, datafiles):
# Assert that we are now in a downloadable state, nothing
# is cached locally anymore
for element_name in all_elements:
- state = cli.get_element_state(project, element_name)
- assert state == 'downloadable'
+ assert cli.get_element_state(project, element_name) == 'downloadable'
# Now try bst pull
result = cli.run(project=project, args=['pull', '--deps', 'all', 'target.bst'])
@@ -170,5 +165,4 @@ def test_push_pull_all(cli, tmpdir, datafiles):
# And assert that it's again in the local cache, without having built
for element_name in all_elements:
- state = cli.get_element_state(project, element_name)
- assert state == 'cached'
+ assert cli.get_element_state(project, element_name) == 'cached'
diff --git a/tests/frontend/push.py b/tests/frontend/push.py
index 9f8bc5b..b5eddf8 100644
--- a/tests/frontend/push.py
+++ b/tests/frontend/push.py
@@ -42,8 +42,7 @@ def test_push(cli, tmpdir, datafiles, override_url, user_url, project_url):
result.assert_success()
# Assert that we are now cached locally
- state = cli.get_element_state(project, 'target.bst')
- assert state == 'cached'
+ assert cli.get_element_state(project, 'target.bst') == 'cached'
override_url = share.repo if override_url == 'share.repo' else override_url
project_url = share.repo if project_url == 'share.repo' else project_url
@@ -92,8 +91,7 @@ def test_push_all(cli, tmpdir, datafiles):
result.assert_success()
# Assert that we are now cached locally
- state = cli.get_element_state(project, 'target.bst')
- assert state == 'cached'
+ assert cli.get_element_state(project, 'target.bst') == 'cached'
# Configure artifact share
cli.configure({