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

PR: Add an option to show/hide line numbers to History #5363

Merged
merged 3 commits into from
Oct 11, 2017
Merged

PR: Add an option to show/hide line numbers to History #5363

merged 3 commits into from
Oct 11, 2017

Conversation

csabella
Copy link
Contributor

Fixes #970.

@pep8speaks
Copy link

pep8speaks commented Sep 29, 2017

Hello @csabella! Thanks for updating the PR.

Line 13:1: E265 block comment should start with '# '
Line 15:1: E265 block comment should start with '# '
Line 31:1: E265 block comment should start with '# '
Line 33:1: E265 block comment should start with '# '
Line 34:1: E302 expected 2 blank lines, found 1
Line 74:1: E265 block comment should start with '# '
Line 76:1: E265 block comment should start with '# '
Line 78:1: E302 expected 2 blank lines, found 1
Line 232:80: E501 line too long (83 > 79 characters)

Comment last updated on October 04, 2017 at 20:26 Hours UTC

@csabella
Copy link
Contributor Author

I added some tests for history.py, but not complete coverage in case the tests weren't the way you would like them. I tried to follow existing patterns, but I didn't do anything with simulating user activity via qtbot. Please let me know if the tests are OK or if they should have been done differently so that I can make sure to apply the correct style if I write more of them. Thanks!

@ccordoba12 ccordoba12 added this to the v4.0beta1 milestone Sep 29, 2017
@ccordoba12 ccordoba12 requested a review from rlaverde October 4, 2017 06:58
@ccordoba12
Copy link
Member

@csabella, thanks a lot for your contribution!

@rlaverde, please review this one.


#==============================================================================
# Constants
#==============================================================================
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this block comment if it's not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

#==============================================================================
# Tests
#==============================================================================

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this blank line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.



@pytest.fixture
def historylog_with_tab(historylog, mocker, monkeypatch):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a docstring to describe what this fixture is about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

# Tests
#==============================================================================

def test_init(historylog):
Copy link
Member

@ccordoba12 ccordoba12 Oct 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a short docstring to all tests to describe what each one is testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. My tests matched to the methods, so I wasn't quite sure what to write. If it's too redundant, I can change it.

@ccordoba12
Copy link
Member

This is a very good addition @csabella, specially because of all the tests you added! Thanks for taking the time to create them.

Copy link
Member

@rlaverde rlaverde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested locally and works as expected 😄
Thanks for adding all those tests 🙇

I leave a comment about moving testing logic out of the plugin

@@ -111,7 +116,8 @@ def __init__(self, parent):
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()
self.register_widget_shortcuts(self.find_widget)
if not self.testing:
self.register_widget_shortcuts(self.find_widget)
Copy link
Member

@rlaverde rlaverde Oct 4, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think It's better to monkeypath this in the test fixture instead of adding test logic to the plugin:

@pytest.fixture
def historylog(qtbot, monkeypatch):
    monkeypatch.setattr(
            'spyder.plugins.history.HistoryLog.register_widget_shortcuts',
            lambda *args: None)

    historylog = history.HistoryLog(None, testing=True)
    [...]

Please remove the testing arg, and monkeypath the fixture

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I had added testing based on test_ipythonconsole, but I agree that the monkeypatch is better.

@ccordoba12
Copy link
Member

Thanks @csabella, this is going in!

@ccordoba12 ccordoba12 changed the title PR: History plugin: Add an option to show/hide line numbers PR: Add an option to show/hide line numbers to History Oct 11, 2017
@ccordoba12 ccordoba12 merged commit fde0f00 into spyder-ide:master Oct 11, 2017
@csabella
Copy link
Contributor Author

Thank you!

@csabella csabella deleted the history_lineno branch October 11, 2017 20:25
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.

4 participants