-
Notifications
You must be signed in to change notification settings - Fork 2
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
feature: testname decorator #30
base: master
Are you sure you want to change the base?
Conversation
A potentially working name decorator, called test_name to not mess with the built-in __name__ attribute.
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.
Alright, great start here. First off, let's go to name
, see what happens when you overload __name__
, if that doesn't play nice, then we can discuss moving everything to __name
style attributes (I have been pondering this for a while and think it would be better, in general, to avoid the dunder style names). Additionally, we should include this in a results test, where we actually inspect the outgoing json file.
Sounds good. I'll make these changes either later tonight or tomorrow, and we'll see how overloading name works. |
Also, how should I write a results test case? What minimal class setup would I need to make a valid result file, and is there a way to easily check the name without having to search through an entire output file? |
I changed it over to name, although I'm still missing the result test cases |
You can add to the test case here: https://github.com/thoward27/grade/blob/master/test/test_runners.py On changing to |
That was what I wanted to ask about. How would I locally test grade? |
You test locally with |
@Jmdwow how is testing coming? Confident this will fly? |
I've been a bit busy on break. I'll get to this hopefully in the next couple days. |
no worries! let me know if you have any trouble rebasing onto master, I've been busy getting us onto poetry and semantic release |
42c1de4
to
91891db
Compare
I will be properly starting work on this again now! Sorry for the long delay! Once I get things properly tested, I'll fix things up with this branch so they work with the most recent version of grade, and then submit the changes for review again. |
So, it appears that name cannot be changed. The error that's happening in the tests is that despite trying to change self.name, the original value is kept. We might have to move to __name or something similar, unless we can come up with a better name for the property. |
@Jmdwow welcome back! Definitely something to be aware of, I've moved to Let me know if you have any questions! |
Ah, okay! I didn't notice that. I'll change to _g_name, and then test it! |
A potentially working name decorator, testname, and the corresponding attribute, testname, called such to not mess with the built-in name attribute. (Maybe name would be okay to use?)
Closes #28 once finished.
decorators.py and mixins.py have been altered, and the function in result.py that determines what name to output checks if a testname attribute exists, using it if it does, and working the same as before if it does not.