New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial test suite #992
Conversation
Well, as embarassing as this is, I have never written up tests before. Any things unique about test code that i should know? I'll look through your code on a general basis and let you know by the end of this week. |
Most of the tests are quite similar. First I fake The tests are written with And, well, practice makes perfect - start small and grow :) |
cool. Thanks for the "well, check this out and this too" - a little head start helps a lot. Thanks again. |
@aklajnert Thanks a ton for getting this in motion. I, like @Mikhail-Zex , have never officially used tests but I see the need for them. Also thanks for documenting use in the readme. Question, would the monkey patches be needed for asyncio? |
It depends on the test, what you want to achieve with it. Probably some mocks will be needed to make the tests faster. If you merge this, I'll build on it to extend the tests and add some more. Preferably on the |
We're definitely merging this. Hey @phcreery review this. I will too. |
Looks good to go for me. |
Should I also change a branch here, or can it go to master? If yes, then I think it could go to both actually. |
Change the branch. I'll merge it. |
@Mikhail-Zex - I've just rebased the changes to the new branch, should be good to go |
Cool. |
This is a very initial test suite that tests mostly the script's entrypoint.
The
DownloadManager
class is entirely mocked, so it not tested.All the HTTP communication is mocked, the responses are stored within
tests/cassettes
directory (everything there is auto-generated).I did also some minor changes in imports to make testing easier.
I can't see any good place to put a description of how to run tests, so I've created a
README.md
within thetests
directory for now.Given the fact that I've focused only to test a single module, the code coverage is decent:
If you are OK with what's already done, I think it could be merged and then I'll work further on extending the suite.