summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-11-29 11:48:19 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2018-01-11 17:07:34 +0000
commit7a9c19984193b1072be4dc9adcbb00bcf732b822 (patch)
tree33a4b0f3b1b83e7adf8643cff06a5bafddcc4f18
parentc4c9a48eb1da5bbb8968998392a3a4b435337e7a (diff)
downloadbuildstream-7a9c19984193b1072be4dc9adcbb00bcf732b822.tar.gz
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.
-rw-r--r--tests/frontend/pull.py18
-rw-r--r--tests/frontend/push.py6
2 files changed, 8 insertions, 16 deletions
diff --git a/tests/frontend/pull.py b/tests/frontend/pull.py
index 530c1e047..5f06e550d 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 9f8bc5b62..b5eddf81c 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({