From 7a9c19984193b1072be4dc9adcbb00bcf732b822 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Wed, 29 Nov 2017 11:48:19 +0000 Subject: 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 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({ -- cgit v1.2.1