-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Type tests #2213
base: master
Are you sure you want to change the base?
Type tests #2213
Conversation
…e to the fact that typing is not possible until the usages are typed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pr is going to be insanely hard to review, so I'm mostly going to base it on tests passing + the pipeline passing.
Any new questionable additions i will comment on as I slowly review this
guild_id=mock.Mock(), # FIXME: Can this be pulled from the actual fixture? | ||
parent_id=mock.Mock(), # FIXME: Can this be pulled from the actual fixture? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing .id
would work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this, I did have it get the hikari_partial_guild
object, and then use the id from it, but I kinda changed how I internally used it. This is more a me problem.
@@ -0,0 +1,126 @@ | |||
from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file seems a bit arbitrary, what's the idea behind it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conftest.py is a pytest feature, that allows any fixtures placed within, to be accessable to any tests within that directory (recursively). The goal for this, is to put all the fixtures that are identical, and used in more than one file, here, to minimize the amount of duplicated fixtures. I simply have not gotten around to moving them, its on my list of todo's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats nice to know, didnt know about that feature. Would be nice to document it in the files docstring (as well as add the missing license :P)
Yeah, its all good. I know this is going to be a massive PR. I will mark things that I think you need to see with a |
Okay, after doing some more changes, I ran nox and a few errors are occurring, but the weirdest part is, they only occur sometimes.
The above three tests are the only ones I have seen fail. Sometimes its two, sometimes its all three, and other times it just happily passes. |
Test order is randomized every time nox is ran, it's to catch flaxy tests or tests that behave differently based on what order they are run. At the top of the pytest output you should see a seed flag with a random number next to it's it you pass it to nox like so: Here I would advice you to look at what order the tests are excuted and the most probable reason is that whatever is running before the first test is modifying the state of whatever is running afterwards. If you provide me the flag, I can have a look too :) I can also give a shot at reproducing it later |
I didn't know it did this. That's pretty useful. Below are some seeds that succeed/fail when ran. Successful seeds: |
Also remove all uses of contextlib.ExitStack in tests where simple 'with' chained blocks work Signed-off-by: davfsa <[email protected]>
Fixed :) |
Signed-off-by: davfsa <[email protected]>
Signed-off-by: davfsa <[email protected]>
Summary
Add typing to all tests, along with a pipeline that forces tests to stay typed.
This will make writing new tests easier, and cleaner.