Merge ~rgildein/charm-duplicity:fix-linting into charm-duplicity:master

Proposed by Robert Gildein
Status: Merged
Approved by: Ramesh Sattaru
Approved revision: 7b38f117a91b9b371ec114457d2c25e5c4b3816c
Merged at revision: af8923ff7c977af1ad7c355a38a57cbe52fd13d8
Proposed branch: ~rgildein/charm-duplicity:fix-linting
Merge into: charm-duplicity:master
Diff against target: 51 lines (+11/-13)
1 file modified
src/tests/unit/test_actions.py (+11/-13)
Reviewer Review Type Date Requested Status
Ramesh Sattaru (community) Approve
Erhan Sunar (community) Approve
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
Review via email: mp+448229@code.launchpad.net

Commit message

fix linting issue with unit test fix

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Erhan Sunar (esunar) wrote :

LGTM

review: Approve
Revision history for this message
Ramesh Sattaru (rameshcan) :
review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision af8923ff7c977af1ad7c355a38a57cbe52fd13d8

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/tests/unit/test_actions.py b/src/tests/unit/test_actions.py
2index d24aa4c..b78db72 100644
3--- a/src/tests/unit/test_actions.py
4+++ b/src/tests/unit/test_actions.py
5@@ -125,15 +125,16 @@ class TestActions:
6 mock_clear_flag.assert_not_called()
7
8 @pytest.mark.parametrize(
9- "exception_raised,expected_fail_contains",
10+ "exp_exception, exp_string",
11 [
12 (
13 CalledProcessError(
14 returncode=2, output="my-error-output".encode("utf-8"), cmd="cmd"
15 ),
16- ["2", "my-error-output"],
17+ 'Command "cmd" failed with return code "2" and error output:\n'
18+ "my-error-output",
19 ),
20- (Exception("generic exception"), ["generic exception"]),
21+ (Exception("generic exception"), "generic exception"),
22 ],
23 )
24 @patch("actions.hookenv")
25@@ -146,20 +147,17 @@ class TestActions:
26 mock_clear_flag,
27 mock_do_backup,
28 mock_hookenv,
29- exception_raised,
30- expected_fail_contains,
31+ exp_exception,
32+ exp_string,
33 ):
34 """Verify action returns an error."""
35 action_args = ["actions/do-backup"]
36- mock_do_backup.side_effect = exception_raised
37+ mock_do_backup.side_effect = exp_exception
38 actions.ACTIONS["do-backup"] = mock_do_backup
39- try:
40- actions.main(action_args)
41- except Exception as e:
42- assert type(exception_raised) == type(e)
43- for expected_contain in expected_fail_contains:
44- assert expected_contain in str(e)
45- mock_hookenv.action_fail.assert_called()
46+
47+ actions.main(action_args)
48+
49+ mock_hookenv.action_fail.assert_called_with(exp_string)
50 mock_remove.assert_not_called()
51 mock_clear_flag.assert_not_called()
52

Subscribers

People subscribed via source and target branches

to all changes: