-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add Python and Javascript unit tests #28
Comments
I'd like to work on this. :) |
@gjergjk71 thanks let me know if you have any questiosn! For Python, in addition to testing the GET/POST requests with Flask testing, you should test individual functions like |
def test_check_code_view(self):
data = {"text":"print('12312')"}
response = self.client.post("/check_code",data=data) returns : While trying to fix this bug I noticed that |
@gjergjk71 can you copy and paste the error here? |
|
@gjergjk71 could you open a pull request or copy and paste the code here so that I can debug it out myself? |
I feel like this would be interesting to work on. Although I feel like doing small piece at a time rather than a gigantic PR would be good. Although it might need some framework like pytest, but unittest is always great if you just want that. I don't want to impede on work currently being done or architectural choices if it would step on peoples toes. What do you think? @ethanchewy |
I don't think @gjergjk71 is working on this anymore. Feel free to start on this PR and break it down into multiple steps by opening seperate, smaller PR's! Thanks! |
Hey @ethanchewy I added pytest just as a runner to simplify the process. I was wondering if you liked the format of these test: #51 I'm open to feedback if you'd like them differently. |
Added comments. Also, food for thought, can we test the following methods as well?
Thanks for all the help and good job! |
Also, are you interested in writing the JS unit tests as well? If not, that's totally fine! |
Hey @ethanchewy thanks for the feedback! This is great, I'm glad you liked the tests. I agree that we should tests those functions, the one thing that I might do is refactor a bit if you're okay with that:) I find it easier to test smaller functions and I think there's some places that I could break it out a bit more. I think I might take a hack at that those functions soon, but I think I'm going to make a separate pull request for that so that we can get this part in, so that there's some work done on this in the master branch. I might take a stab at the JS tests, but not right now:) PS. I really think this is a cool project, thanks for letting me a part of it. |
Sounds good! |
Yeah I can take a look at this. I think we can take a look at this @chaps has the tests for all of the empty pages which is good. Suggestion for merging, we could merge one (say @chaps PR) then rebase the other branch and merge the other one in (say @dgmouris) we could do this in any particular order. Let me know what you think, as that might be a messy task. Would you like me to review and add some thoughts to #52, #53 (as we're working on the same thing)? |
@dgmouris yeah, that would be great if you could review them! |
Hey @ethanchewy I tested those methods referenced in the above comment
I removed the file delete into its' own function because i couldn't get the "flask_test_client" parameter in the "socket_io.test_client" function to work. Let me know what you think. I've also added the travis runner, and how to get an html coverage report and added it into the .gitignore. Sorry its' such a huge PR. but coverage at 92% :) |
I also check to see that the file contents are changed in the tempfile. |
@dgmouris sounds good - thanks so much! In general, for best practices, you should make your PR as small as possible. So, it's better to have multiple, smaller PR's instead of 1 giant PR. This makes it easier to read and also reference to in the future if we need to roll back the repo for some reason. Thanks! |
@ethanchewy I agree, but there was another PR working on the exact same thing... ( #52, #53 ) otherwise I would have made them smaller PRs. |
I was thinking perhaps of taking a stab at the JS tests for this project, as it's kind of "greenfield" area in this repo. I was thinking of maybe using jest... I don't want to overstep bounds by making framework decisions on a project, so would like to throw this by you if you have any preference for JS testing frameworks. PS. sorry for the huge PR:) |
@dgmouris that sounds good to me! Sorry I have to finish a few deadlines for my school commitments but I should be able to review and merge your PR's within the next week! |
Hey no worries, take your time! |
Goal:
Write unit test for Javascript and Python files (https://github.com/ethanchewy/PythonBuddy/blob/master/app.py, https://github.com/ethanchewy/PythonBuddy/blob/master/static/js/javascript.js, and https://github.com/ethanchewy/PythonBuddy/blob/master/static/js/cm-validator-remote.js)
How to do this?
Expected results should be fairly straight forward. Just play around with pylint and error messages and just write example cases with said code and pylint response.
The text was updated successfully, but these errors were encountered: