test: ✅ mocking of basic app functionality#155
Conversation
This didn't work before
lwjohnst86
left a comment
There was a problem hiding this comment.
Nice! Some I don't understand the code but understand the concept/intent. Some small questions/comments.
Co-authored-by: Luke W. Johnston <lwjohnst86@users.noreply.github.com>
martonvago
left a comment
There was a problem hiding this comment.
Very nice, I look forward to using this 😁
|
Just one question: |
|
@martonvago Great question! And interesting find with What do you think about the asserts used in test_build_with_mocked_internals where we check that the correct object is passed to the different functions inside build? If the correct object is passed to e.g. |
lwjohnst86
left a comment
There was a problem hiding this comment.
Add the helper function and I will approve after
|
@joelostblom What So this test makes sense if we want to test that |
|
Ah yes, you're right, I set the return value from Hmmm... what do you think of the approach we mentioned before regarding testing that the eventual output files are written with a correct structure in the correct location? That's of course a more indirect way and doesn't test each individual internal function so it might be hard to tell what is failing inside. Maybe we can try that and see if it clear enough from the stack trace what is going awry, and otherwise move to explicitly test internals if there is something that is so complex that it is hard to tell what went wrong if we don't explicitly test the internal function directly? |
|
Yeah, I'm happy with that! |
|
Sounds good! I split our discussion out into its own issue so that it doesn't get lost in this PR #156 |
lwjohnst86
left a comment
There was a problem hiding this comment.
Very nice! Only some small things with the tool script.
lwjohnst86
left a comment
There was a problem hiding this comment.
Much better, thankkksss ❤️
This is a first implementation of the tests we can use to check that the CLI is behaving correctly. I think this covers most of what we currently have in main, at least we reach 💯 % coverage!
Merging this before some of the existing PRs e.g. #140 and #152 will make it easier to add new tests specifically for the functionality added there instead of convoluting it with testing the general functionality of the app which is tested here instead.
I tried to follow the cyclopts test docs as closely as possible, but let me know if you think something is missing. I also experimented with using the Copilot CLI for the first time to help me get started and understanding how to write the tests. It was quite useful, particularly to get started, but I did have to delete about half of its suggestions because there was a lot of redundancy. Thought I would mention it in case someone catches something odd in here so I can blame it and not me =p
Needs a thorough review.
Checklist
just run-all