Weekly Check-In #2

Utkarsh
Published: 06/21/2021

Hey everyone, this is me checking in after my second week in GSOC. This week I had to work on unit testing with pytest and pytest-vcr-- PR#63. My work included fixing the already developed tests for the new test suite and also generate cassettes for replaying the tests. This was done to countermeasure the situation if the AFIP servers ever went down.

What did you do this week?

This week’s work was comparatively tougher than the last week’s. I had to fix the tests that were designed in Gsoc 2019. These tests were for the major python scripts in this project. I mainly worked on the issues that arose from PR#59.
These issues were mainly due to the merging of the tests in the new main branch. I also had to work on generating cassettes for the tests as I recorded them using pytest-vcr. This was very useful and necessary because the tests continuously made requests to the server for authentication. Once authenticated the servers would return a message - Falla SOAP: ns1:coe.alreadyAuthenticated: El CEE ya posee un TA valido para el acceso al WSN solicitado. This was the case because the tickets generated were already authorized and we needed to wait sometime before trying to authenticate again. Since the tests needed to run without waiting in the Github wokflow, cassettes for all tests were generated.

Did you get stuck anywhere?

Yes, and badly. As this was my first time working with pytest-vcr, using the right decorators and fixtures was a nightmare. The main problem was that the tests were making a lot of redundant requests and while replaying were casing the error - CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('cassette.yaml') in your current record mode ('once').. Fixing this issue was most overwhelming to me because there were more that 120 tests and I had to fix errors in each.