ashb commented on a change in pull request #6407: [AIRFLOW-5740] Fix Transient
failure in Slack test
URL: https://github.com/apache/airflow/pull/6407#discussion_r338516150
##########
File path: tests/contrib/hooks/test_slack_webhook_hook.py
##########
@@ -105,7 +105,7 @@ def test_build_slack_message(self):
message = hook._build_slack_message()
# Then
- self.assertEqual(self.expected_message, message)
+ self.assertCountEqual(self.expected_message, message)
Review comment:
I don't think it does what we want:
```
In [10]: tc = unittest.TestCase(); tc.assertCountEqual({"a":2}, {"b": 3})
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-10-bfc26b17fbb0> in <module>
----> 1 tc = unittest.TestCase(); tc.assertCountEqual({"a":2}, {"b": 3})
~/.homebrew/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py
in assertCountEqual(self, first, second, msg)
1198 standardMsg = self._truncateMessage(standardMsg, diffMsg)
1199 msg = self._formatMessage(msg, standardMsg)
-> 1200 self.fail(msg)
1201
1202 def assertMultiLineEqual(self, first, second, msg=None):
~/.homebrew/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py
in fail(self, msg)
678 def fail(self, msg=None):
679 """Fail immediately, with the given message."""
--> 680 raise self.failureException(msg)
681
682 def assertFalse(self, expr, msg=None):
AssertionError: Element counts were not equal:
First has 1, Second has 0: 'a'
First has 0, Second has 1: 'b'
In [11]: tc = unittest.TestCase(); tc.assertCountEqual({"a":2}, {"a": 3})
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services