-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Nose cleanup first step #13206
Nose cleanup first step #13206
Conversation
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.
A couple of comments, I think you forgot one assert.
I'm also trying to see if it's possible to rebase and and applying the reformat hook to each commit, so that it does not complain in the test suite. If that works i'll point you to the rebased branch and the reformat commit, and we can decide if we ant to squash them or not.
Feel free to also do many smaller PRs, that might allow me to quickly review them and merge when I'm in between two compilations or waiting on another test suite.
, to see if I can get the test to pass, and
@@ -329,16 +326,16 @@ def test_no_ascii_back_completion(self): | |||
# single ascii letter that don't have yet completions | |||
for letter in "jJ": | |||
name, matches = ip.complete("\\" + letter) | |||
nt.assert_equal(matches, []) | |||
self.assertEqual(matches, []) |
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.
if it's always skipped we might as well delete the test ?
Can be done in separately, just taking notes.
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.
Agreed
I think that a separate step is better to keep things clear.
IPython/core/tests/test_display.py
Outdated
nt.assert_raises(ValueError, display.Image) | ||
nt.assert_raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True) | ||
pytest.raises(ValueError, display.Image) | ||
pytest.raises(ValueError, display.Image, data='this is not an image', format='badformat', embed=True) |
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.
👍 I wasn't aware you could use pytest raises like so.
|
||
def test_cellmagic_help(self): | ||
self.sp.push('%%cellm?') | ||
nt.assert_false(self.sp.push_accepts_more()) | ||
assert not self.sp.push_accepts_more() |
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.
Philosophical question, is nt.assert_false equivalent to that, or equivalent to is false
, because:
>>> not ''
True
? I think that's fine here, but just leaving my own questioning here.
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.
I guess it's the same for assert vs assert_true...
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.
You raise a good point.
Being more explicit with is false
and is true
will also makes the expected output of the method clearer. I'll update the checks.
from matplotlib import pyplot as plt | ||
import matplotlib_inline | ||
from matplotlib_inline import backend_inline |
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.
did you meant to do some more refactor ?
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.
Not exactly, on my machine, if backend_inline
is not explicitly imported, I get AttributeError: module 'matplotlib_inline' has no attribute 'backend_inline'
.
It might be because I installed matplotlib through conda rather than pip.
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.
@martinRenou ? Want to add ad from . import backend_inline
in __init__.py
?
I want to make sure @Kojoley sees that and does not do too much of duplicate work. My computer is still rebasing and applying the auto formatter, Will post updates when it's finished. |
You can check this branch https://github.com/Carreau/ipython/tree/nose_cleanup_first_step, it is the same as your except every-other commit run the reformat step. If you want I can either push it as it, or squash every other commits to be part of what you did, and I can also push to your branch. Let me know if you want me to do that. |
On this kind of changes it is useful to check code coverage for regressions. I see that CI is uploading coverage to codecov https://codecov.io/github/ipython/ipython/commit/fdee94ec9e877777cd30beccb1b42e744fb42d10 but no info is added to the PR status, is it intentionally? |
I don't quite remember, I believe that when we originally added codecov the bot was poting a new comment on each push/each time a new CI item would finish. I don't believe it's the case anymore so we can re-enable. I'll see if I can do Sidenote, there is a conflict now. |
Yeah, that bot could be quite annoying, but it is not required for the status updates through API that just adds a line with code coverage stats in PR "checks" status box. |
I'm not quite sure why the status is not posted. I'm going to try things in #13207 |
With regard to darker, what about introducing |
I think it would be ok to add. I have it personally as an editor hook so I don't need a pre-commit hook. But I'm also a bit worried it is as disruptive for users, in another project I work on, the pre-commit hook takes 5 sec, and every other time prevent me from committing even if I know i don't care about having all the files formatted, and no unused variables. So I'd be happy to have one, but I don't want to enforce it if it disturb user. in this particular PR, as you seem to be fairly familiar with git and it touched a bunch of files, I pushed to have each commit properly formatted, but on a new contributor, and smaller PRS I would have just pushed a single formatting commit before merging. |
I am all for properly formatted code. As matter of fact I wanted to ask about doing a round of black/isort run once the move to For pre-commit hooks, there's nothing to worry about for newcomers. If you don't run However, I think that encouraging them to use it will also help them learn the tool which is beneficial. |
Needs more work to remove all nose related code
I think there might be some issue with code coverage as it looks like Windows is not taken into account and there are quite a lot of tests that are skipped of it. |
Don't worry about github and coverage for now unless there is a delta which is gigantic. |
rev: 1.3.1 | ||
hooks: | ||
- id: darker | ||
|
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.
+1 awesome.
from matplotlib import pyplot as plt | ||
import matplotlib_inline | ||
from matplotlib_inline import backend_inline |
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.
@martinRenou ? Want to add ad from . import backend_inline
in __init__.py
?
Ok, let's get that in. |
Thanks ! |
This merge request goes through the test files and makes a first pass cleanup to remove the direct use of nose in the test files themselves.
Each file has been cleaned up independently so that it can be reviewed in an easy fashion.
Part of #13108