Taragolis commented on PR #27198:
URL: https://github.com/apache/airflow/pull/27198#issuecomment-1287756983

   Additional findings or ideas which could be done in separate PR's
   
   ### SkipIf decorator wouldn't work in case of `moto` decorators. Because all 
decorators should be applied first
   
   ```python
   try:
       from moto import mock_sts
   except ImportError:
       mock_sts = None
   
   ...
   
   @pytest.mark.skipif(mock_sts is None, reason="mock_sts package not present")
   @mock_sts
   def some_test_case():
       ...
   ```
   
   We got an error `TypeError: 'NoneType' object is not callable` possible 
solutions:
   1. Do not use try..except - if some mock decorators removed or specific 
`moto` extra package not installed we just got ImportError which more clear
   2. Use inside of fixtures
   3. Create own decorator which check that specific mock client exists or not
   
   ### New major version `moto` might broke tests in the future
   
   Might be better pin `moto~=4.0.0` in 
[setup.py](https://github.com/apache/airflow/blob/5e542e7532521665dadc4d428c53cbc8e7e57c66/setup.py#L379)?
   
   


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