-
Notifications
You must be signed in to change notification settings - Fork 68
Simplify and deduplicate test code #642
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
Conversation
|
Hello @mulhod! Thanks for updating this PR.
Comment last updated at 2020-11-13 17:39:06 UTC |
|
|
||
| import csv | ||
| import json | ||
| import os |
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.
Why remove import?
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.
It was only being used for os.unlink, which isn't being used anymore. Now pathlib.Path.unlink is being used (but it's actually used indirectly -- it's in a helper method in tests.utils that coerces the argument to a Path so that we don't have to care about whether the path is a str or a Path).
Codecov Report
@@ Coverage Diff @@
## main #642 +/- ##
=======================================
Coverage 95.11% 95.11%
=======================================
Files 27 27
Lines 3089 3089
=======================================
Hits 2938 2938
Misses 151 151
Continue to review full report at Codecov.
|
|
This PR removes over 450 lines from the tests! |
desilinguist
left a comment
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 is fantastic, @mulhod! Thanks for taking this on – this is a really nice improvement of the codebase.
I made a couple of minor suggestions. I also have a couple of broader suggestions:
-
Can you run the tests locally to make sure that all the created files are actually being cleaned up properly? As long as we are working on this, it would be good to make sure of those.
-
I am a little concerned about changing the
from tests.utils import Xstatements tofrom .utils import Xin terms of the impact this will have on the testing of the PyPi and conda packages. In those scenarios, we install the conda package, do a sparse checkout of the skll tests and then run the tests. I think you should be able to test this by making a local conda package and simulating this scenario.
Thanks again!
Thanks, @desilinguist! I decided to revert the parts that used relative imports for now. It's a minor change, anyway. I have run all the tests and fixed a couple cases (one that you pointed out!). I think most of the cases were actually issues with the tests that didn't have anything to do with my changes. But, this gave me the chance to really see what files are left behind, so I just fixed any I saw. |
|
Thanks so much for doing that @mulhod ! |
desilinguist
left a comment
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.
LGTM! 👍
Closes #635.