Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jmdwow
Copy link
Contributor

@Jmdwow Jmdwow commented Mar 5, 2020

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.

A potentially working name decorator, called test_name to not mess with the built-in __name__ attribute.
Copy link
Owner

@thoward27 thoward27 left a 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.

grade/result.py Outdated Show resolved Hide resolved
@Jmdwow
Copy link
Contributor Author

Jmdwow commented Mar 6, 2020

Sounds good. I'll make these changes either later tonight or tomorrow, and we'll see how overloading name works.

@Jmdwow
Copy link
Contributor Author

Jmdwow commented Mar 6, 2020

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?

@Jmdwow
Copy link
Contributor Author

Jmdwow commented Mar 6, 2020

I changed it over to name, although I'm still missing the result test cases

@thoward27
Copy link
Owner

thoward27 commented Mar 6, 2020

You can add to the test case here: https://github.com/thoward27/grade/blob/master/test/test_runners.py

On changing to __name__, did you notice any odd behavior? If we just set name, what does __qualname__ look like? We should check all sorts of names, including spaces and whatnot

@Jmdwow
Copy link
Contributor Author

Jmdwow commented Mar 6, 2020

That was what I wanted to ask about. How would I locally test grade?

@thoward27
Copy link
Owner

You test locally with python -m unittest discover

@thoward27
Copy link
Owner

@Jmdwow how is testing coming? Confident this will fly?

@Jmdwow
Copy link
Contributor Author

Jmdwow commented Mar 11, 2020

I've been a bit busy on break. I'll get to this hopefully in the next couple days.

@thoward27
Copy link
Owner

no worries! let me know if you have any trouble rebasing onto master, I've been busy getting us onto poetry and semantic release

@thoward27 thoward27 force-pushed the master branch 4 times, most recently from 42c1de4 to 91891db Compare March 12, 2020 02:13
@Jmdwow
Copy link
Contributor Author

Jmdwow commented Oct 27, 2020

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.

@Jmdwow
Copy link
Contributor Author

Jmdwow commented Oct 27, 2020

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.

@thoward27
Copy link
Owner

@Jmdwow welcome back! Definitely something to be aware of, I've moved to _g_attribute naming: https://github.com/thoward27/grade/blob/master/grade/mixins.py#L54

Let me know if you have any questions!

@Jmdwow
Copy link
Contributor Author

Jmdwow commented Oct 28, 2020

Ah, okay! I didn't notice that. I'll change to _g_name, and then test it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A Feature to Name Test Cases
2 participants