Lee-W commented on PR #33687:
URL: https://github.com/apache/airflow/pull/33687#issuecomment-1691703357

   > > Is it possible to test this?
   > > Not really, my impression is this wouldn’t be easy to test anyway, hence 
the question 😛
   > 
   > Yes. We often do a mock-only tests and It's also important. Mock is really 
a representation of "How the author imagined the code would interact with the 
external world". Since you tested it, and you have good understanding how it 
works. Coding that in the form of mock is capturing that knowledge.
   > 
   > Imagine somene else making a change to that code 2 months from now. Or 
even YOURSELF doing it 2 months from now (I always try to picture future-self 
coming back to the code after I completely forgot what it does). If there is no 
mock and someone changes the behaviour accidentally, they won't notice and it 
might stop working accidentally. But when it fails, you will look at your test, 
and you will be able to quickly recall the intent you had without heavy 
debugging.
   > 
   > I really treat those tests with mocks often as description of what I 
thought the class in question shoudl be doing - so that I even don't have to 
remember it.
   
   Got it. Thanks @potiuk for such a detailed response. I'll try to add some 
mock tests tomorrow 


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