-
Notifications
You must be signed in to change notification settings - Fork 6
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
Possibility for unit tests? #28
Comments
I agree that unit tests would be good, but I don't know anything about what frameworks are good for Python unit tests. Most of the API functionality is already split off into classes, so it shouldn't be too hard to mock out most of that stuff. The hardest testing part is probably going to be the stuff in @michaelwisely any thoughts? |
I've used unittest successfully in the past. It's simple and efficient, and now it has the unittest.mock library as well. My thoughts are, since the assigner.py file seems to be getting more and more bloated, now might be a good time to break it up into individual commands. I've seen that pattern in several CLI projects before, and I think it would do great here. That will make assigner.py very short, and we will have a modular framework where each command is a separate file (moving common code to library functions as needed). That will allow us to write unit tests each individual command in a clean manner, with the added benefit of being able to add, remove, and debug commands easily and cleanly. A (simple) example of the philosophy I have in mind is explained here. |
I took a first stab at the modular CLI approach, and here's the result. This is purely refactoring; I didn't change the code for any of the commands, but I wrote a small bit of code that lists the I tried to make sure the commands are as de-coupled from As I said, this is only a first attempt at it. I have a feeling there's a better way than having to list all the modules in Please take a look at it and let me know what you think. And if you want to test it, please make sure you fetch and merge #36 as well, because that error prevents both the |
Forgot to add: I'm also not super happy with the way I passed the |
@michaelwisely pointed out that Grader already has separate files for each command; it'd be good to mirror that architecture. |
Cool, so it looks like the modular CLI part is done. I am not interested, personally, in making unit tests here. I do see utility in setting up an integration test though. I think I'll spawn off an other issue for some integration-style sanity tests. Edit: |
I think long-term I'd like to split the git and GitLab parts of |
I could mock it. Right now, this sounds like a lot of fun for some reason. I'm going to look into this. |
Modules to write tests for:
|
Something that's coming up as I'm trying to make additions and improvements to this, is the fear of accidentally breaking some existing functionality. Having at least some unit test coverage would be a blessing in this case.
I figured we can start a conversation on how we could possibly do that, what would be important things to consider, and so on.
The text was updated successfully, but these errors were encountered: