-
Notifications
You must be signed in to change notification settings - Fork 15
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
Reformat test structure and imports #50
Conversation
Thank you so much for your pull request! I'll have a look at the details and integrate it as soon as possible. |
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.
Thank you so much for the hard work you've put inthis contribution!
I have not gone through the whole review yet.
My first concern would be to ensure that the CI runs smoothly on all Python versions.
Currently, the pre-checks are failing because of the line length - the best option is to change the pycodestyle limit in the travis configuration.
Also, I suspect other tests would fail at runtime (at least on the older Python versions)
If you decide to spend more time on this, I would appreciate if things could be split into pull-requests with a somehow clearer scope. For instance, one for black (and typo), one for the reorganisation, etc. If you can't be bothered, that's fine as well.
Let me know if there's anything I may help you with
All the best!
didyoumean/api.py
Outdated
@@ -110,6 +113,3 @@ def didyoumean_disablehook(): | |||
"""Function to set hooks to their normal value.""" | |||
sys.excepthook = sys.__excepthook__ | |||
set_ipython_custom_exc(None) | |||
|
|||
# NOTE: It could be funny to have a magic command in Python |
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.
Do you know why this got removed ?
tests/dre_test.py
Outdated
self.assertRegexpMatches(name, regex) | ||
for name in ['1a']: | ||
self.assertNotRegexpMatches(name, regex) | ||
# def test_var_name(self): |
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.
Sorry for that one - I guess it caused you troubles.
Would you remember which name led to problems by any chance ?
tests/dre_test.py
Outdated
@@ -31,7 +32,7 @@ def re_matches(self, text, regexp, results): | |||
and groupdict(). | |||
""" | |||
groups, named_groups = results | |||
self.assertRegexpMatches(text, regexp) # does pretty printing | |||
self.assertRegex(text, regexp) # does pretty printing |
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.
The reasoning for this was to ensure the lib was usable and testable under all Python version >= 2.6.
Indeed, somes of the reasons caught and handled are somehow related to running a piece of Python code with the wrong version of the interpreter (not as common now but a few years back, using 2.7 instead of 3.0+ or the other way round was a common gotcha).
Would it be possible to revert that part of the patch ?
didyoumean/dre.py
Outdated
r"^(?:local|free) variable '(?P<name>{0})' " | ||
r"referenced before assignment(?: in enclosing scope)?$".format(VAR_NAME) | ||
) | ||
NAMENOTDEFINED_RE = r"^(?:global )?name '(?P<name>{0})' " r"is not defined$".format( |
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.
Now, this line (and a few others) are considered too long by the call to pycodestyle on travis.
Would it be possible to either:
- tweak the travis config to disable the corresponding warning ( E501 )
- run black with a different line length limit
(I think option 1 is both an easier and cleaner option)
https://travis-ci.org/github/SylvainDe/DidYouMean-Python/jobs/730786126
Note: I don't know why this does not appear more explicitly here but you can find the Travis runs for your Pull Request here: https://travis-ci.org/github/SylvainDe/DidYouMean-Python/builds/730786103 . |
Are you dedicated to supporting Python 2.6 at this point? All versions of up to Python 3.5 have reached end-of-life by now (https://endoflife.date/python), so it seems wise to move along with this trend - especially if this project is not currently used by many people yet. It would be pretty easy to split this into multiple changes - I can do it sometime this week. Thanks for reviewing the changes! |
24ebcef
to
7aba306
Compare
This looks great! Thanks for the additional work you've gone through. Unfortunately, I can see that the CI is failing - https://travis-ci.org/github/SylvainDe/DidYouMean-Python/pull_requests . Would you have any idea about what happened ? As for the support for older Python version, I'd rather keep it until it does bring a lot more troubles while moving forward. If it is only for DeprecationWarning, I'd rather add a few wrappers around the unit-test methods to ensure that everything works smoothly in all cases. |
Correct spelling for "dictionnary" is "dictionary". This is one of the things hilighted in: #50
Hello @TylerYep , I've performed a few changes which will unfortunately lead to merge issues. To you mind resubmitting your code organisation PR ? (If you want, I can perform it myself based on the work you've done and try to give you the proper attribution). Similarly, I can perform the call to Black in a different commit if you want. Please let me know how you want to handle these and thanks for your work! |
Resubmitted the PR. I can go ahead and create the PR for the black formatting, but could you fix the travis CI integration first?
As a side note, I would also really recommend upgrading to a newer toolchain for linting + testing. I believe the more common standard now is Pytest should be able to execute all unittests without any modifications, but with a better test-discovery. The following commands should do everything correctly and concisely in the .travis.yml:
|
Thanks for all the suggestions ! It looks like I have not followed the latest trends on a few aspects indeed. |
Hi, I was interested in using this project, but ran into some issues with pip installing the package. I ended up renovating the project to fit my needs, and thought there was a chance you might be interested in using the changes.
Please feel free to take these changes or throw them away, I'm mainly just leaving this PR here as a suggestion of possible improvements!
Changes included:
isort .
black .
didyoumean
files to make imports easiertests/
folder to avoid mixing source files with test filespytest