Week 2 - Test suite conversion to pytest continues!

Published: 06/13/2023


I ended week 1 feeling a little behind in pace, so I worked though the weekend to parameterize two test files: 'item' and 'version'. These tests needed relatively small changes compared to the other files in the test suite, so I knocked them out and had a PR merged by the end of the weekend. This felt good, and led to me starting week 2 on a high note. Unfortunately, this is where my accomplishments ended, as I hit a lot of roadblocks on my next task: repository tests. Oh man, I got caught up a lot here! Lets dive in...


On the surface, the repository tests were a straight forward conversion from Unittest to Pytest. I needed to create a pytest fixture that replicated the unittest setup and teardown functions, then mimic the reopen functionality that closes a repository and reopens the same repo fresh from disk. Finally, I would translate the roughly 1,100 lines of tests to pytest. Unfortunately, things did not go to plan. I was able to get the repository fixture to work, however things went awry when I tried to reopen the repo, as I ended up nesting context managers in a way that was both ugly to read and also did not function as intended. I want to thank my mentors and the community for all the help pointing me in the right direction as I work to rewrite the tests in a way that did not nest the context managers and helped the code execute (mostly) as intended. By Friday, I had completed translating all 1,100 lines from unittest into pytest, however I am still working to ensure the repository fixture and reopen context manager works as intended.

The Week Ahead:

Going into week three I plan on wrapping up the repository tests and begin working on the next tests that need help: xattr, archive, and the archiver commands folder of tests. I certainly have my work cut out for me, but thanks to my supportive mentors and a wonderful community of helpers, I am confident I will continue to make solid progress.

Thank you all for taking the time to read my blog, and I look forward to updating you again next week!