You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/12/01 20:54:06 UTC

[GitHub] [airflow] ferruzzi commented on a diff in pull request #28039: Migrate amazon provider hooks tests from `unittests` to `pytest`

ferruzzi commented on code in PR #28039:
URL: https://github.com/apache/airflow/pull/28039#discussion_r1037539606


##########
tests/providers/amazon/aws/hooks/test_glue_crawler.py:
##########
@@ -83,18 +82,17 @@
 }
 
 
-class TestGlueCrawlerHook(unittest.TestCase):
-    @classmethod
-    def setUp(cls):
-        cls.hook = GlueCrawlerHook(aws_conn_id="aws_default")
+class TestGlueCrawlerHook:
+    def setup_method(self):
+        self.hook = GlueCrawlerHook(aws_conn_id="aws_default")
 
     def test_init(self):
-        self.assertEqual(self.hook.aws_conn_id, "aws_default")
+        assert self.hook.aws_conn_id == "aws_default"
 
     @mock.patch.object(GlueCrawlerHook, "get_conn")

Review Comment:
   I mentioned on slack that I had started on some of these; this was the rabbit hole that got me there... I started updating any hooks that still used get_conn() instead of the conn cached property, which led to updating the mocked values in the unit tests, which led to converting them all to pytest which... never got finished :P   So again, thanks for taking this on!



##########
tests/providers/amazon/aws/hooks/test_glacier.py:
##########
@@ -47,25 +47,21 @@ def test_retrieve_inventory_should_return_job_id(self, mock_conn):
         assert job_id == result
 
     @mock.patch("airflow.providers.amazon.aws.hooks.glacier.GlacierHook.get_conn")
-    def test_retrieve_inventory_should_log_mgs(self, mock_conn):
+    def test_retrieve_inventory_should_log_mgs(self, mock_conn, caplog):
         # given

Review Comment:
   Do we want to remove the `given/when/then` comments in the very few places they still exist while we're at it?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org