Weekly Check-In #9

Utkarsh
Published: 08/08/2021

This blog marks the check-in for the 9th week of my GSoC experience. As this week is the penultimate week before the second evaluation, my work is to finish any previous left work and also to wrap up for the final submission. My mentors asked me to work on 3 scripts, namely, pyemail.py, pyi25.py and ,pyqr.py. My work was to develop unit tests for the scripts and also to increase their code coverage.

What work is to be done?

As mentioned above, this week, like the previous week had me working on unit tests and code coverage. The scripts that I was told to work on were different from the previous ones in the sense that these scripts were not dependent on other scripts for functioning , which made working with them a little less tiresome.
Also the unit tests had to be developed differently for them. Let me explain with an example:-
The script pyemail.py can be used for email services and requires the valid email and password of the user in order to work correctly. Since this is not possible while testing, my mentors suggested me to use pytest-mock, which be used to mock the functionality of modules while testing. In this example that module was smtplib.

Did I get stuck anywhere?

Yes, initially I had no idea to test such scripts that require the authentication of user's personal credentials in order to function. I was helped greatly by my mentors who informed me about pytest-mock and how it can be used to check if a certain function was being called or not. As you can understand this was enough in this case.