dabla commented on code in PR #43494:
URL: https://github.com/apache/airflow/pull/43494#discussion_r1832182465


##########
providers/tests/microsoft/azure/triggers/test_powerbi.py:
##########
@@ -39,19 +39,22 @@
 
 
 @pytest.fixture
-def powerbi_trigger():
-    trigger = PowerBITrigger(
-        conn_id=POWERBI_CONN_ID,
-        proxies=None,
-        api_version=API_VERSION,
-        dataset_id=DATASET_ID,
-        group_id=GROUP_ID,
-        check_interval=CHECK_INTERVAL,
-        wait_for_termination=True,
-        timeout=TIMEOUT,
-    )
+def powerbi_trigger() -> PowerBITrigger:

Review Comment:
   I would rewrite the fixture as this without nested method:
   
   ```
   @pytest.fixture
   def powerbi_trigger(timeout=TIMEOUT, check_interval=CHECK_INTERVAL) -> 
PowerBITrigger:
       """Fixture for creating a PowerBITrigger with customizable timeout and 
check interval."""
       return PowerBITrigger(
           conn_id=POWERBI_CONN_ID,
           proxies=None,
           api_version=API_VERSION,
           dataset_id=DATASET_ID,
           group_id=GROUP_ID,
           check_interval=check_interval,
           wait_for_termination=True,
           timeout=timeout,
       )
   ```
   
   You can then parametrize the fixture in the tests by using the 
@pytest.mark.parametrize if needed. 
   
   That way you can again do:
   
   `task = asyncio.create_task(powerbi_trigger.run().__anext__())`
   
   instead of:
   
   `task = asyncio.create_task(powerbi_trigger().run().__anext__())`



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to