-
Notifications
You must be signed in to change notification settings - Fork 155
Tests formatted as per PEP8 guidelines #227
Conversation
Was this done manually or did you run a linter? If the latter, it might be better to add that to the makefile and travis scripts so that the linter can run automatically. Also, I think you have to adjust the rules of the linter as the license headers should be comments, not a string literal. |
For now I've done manually only. But adding a linter is a good suggestion. I'll add that surely then... |
tests/test_TUDPTransport.py
Outdated
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" |
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.
copyright header is not a docs string, it should remain as comments,
not opposed to merging this, but need to address a couple of things:
|
It seems 'flake-8' is already present as a style guiding linter in make file. But still I can see some errors in the code related to PEP-8 format. Can we enforce PEP-8 in .travis.yml so that pep-8 can check the .py files for any violations? |
looks like we already run flake-8 in travis https://github.com/jaegertracing/jaeger-client-python/blob/master/.travis.yml#L33; are we possibly swallowing the errors in travis? |
@pravarag I don't understand what you mean. There are no errors from flake8:
which is why I asked above: when you say "still I can see some errors", which linter are you running? -- UPDATE -- |
related #231 |
@yurishkuro with errors in tests, I meant that code in few of the test files is still not indented as per PEP8. As you have mentioned in #231 , that tests is excluded from flake8 configuration. So, any chance tests will be included in flake8 configuration in near future? |
@pravarag I am now clear on what was happening (I updated my #227 (comment) above). If you would like to finish this PR and address the comments, we will merge it and enforce linting of tests going forward. |
@yurishkuro , I've updated the code with the following now, make lint reports PEP8 errors if there are any in jaeger-client, crossdock & tests. |
Codecov Report
@@ Coverage Diff @@
## master #227 +/- ##
=======================================
Coverage 94.59% 94.59%
=======================================
Files 25 25
Lines 1867 1867
Branches 247 247
=======================================
Hits 1766 1766
Misses 66 66
Partials 35 35 Continue to review full report at Codecov.
|
4d4b8f0
to
a69311f
Compare
tests/test_TUDPTransport.py
Outdated
@@ -13,10 +13,8 @@ | |||
# limitations under the License. | |||
|
|||
from __future__ import absolute_import | |||
|
|||
import mock | |||
# import mock # noqa: F401 |
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.
Instead of commenting, I think we should remove the import if it's not used
tests/test_TUDPTransport.py
Outdated
import unittest | ||
|
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.
Let's keep this blank line to separate the standard imports from out own modules
tests/test_config.py
Outdated
@@ -133,18 +133,19 @@ def test_throttler(self): | |||
|
|||
def test_for_unexpected_config_entries(self): | |||
with self.assertRaises(Exception): | |||
_ = Config({"unexpected":"value"}, validate=True) | |||
_ = Config({'unexpected': 'value'}, validate=True) | |||
assert _ |
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.
Can you do this same as you did for other cases? i.e. just call Config({"unexpected":"value"}, validate=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.
what is the purpose of adding assert, since it's never expected to be reached?
tests/test_crossdock.py
Outdated
@@ -1,13 +1,13 @@ | |||
# Copyright (c) 2016-2018 Uber Technologies, Inc. | |||
# | |||
# Licensed under the Apache License, Version 2.0 (the "License"); | |||
# Licensed under the Apache License, Version 2.0 (the 'License'); |
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.
Please revert this
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.
please do not change license headers, they are standard and not subject to code guidelines
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.
okay, I'll revert back the changes..
tests/test_crossdock.py
Outdated
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# distributed under the License is distributed on an 'AS IS' BASIS, |
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 as well
tests/test_reporter.py
Outdated
@@ -12,7 +13,7 @@ | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
# |
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 as well?
tests/test_sampler.py
Outdated
@@ -1,18 +1,19 @@ | |||
from __future__ import division | |||
# Copyright (c) 2016-2018 Uber Technologies, Inc. | |||
# | |||
# Licensed under the Apache License, Version 2.0 (the "License"); | |||
# Licensed under the Apache License, Version 2.0 (the 'License'); |
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.
Same as above
tests/test_sampler.py
Outdated
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# distributed under the License is distributed on an 'AS IS' BASIS, |
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.
Same as above
tests/test_tracer.py
Outdated
@@ -1,13 +1,13 @@ | |||
# Copyright (c) 2016 Uber Technologies, Inc. | |||
# | |||
# Licensed under the Apache License, Version 2.0 (the "License"); | |||
# Licensed under the Apache License, Version 2.0 (the 'License'); |
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.
Same as above
tests/test_tracer.py
Outdated
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# distributed under the License is distributed on an 'AS IS' BASIS, |
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.
Same as above
tests/test_reporter.py
Outdated
@@ -1,4 +1,5 @@ | |||
from __future__ import print_function |
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 import should go after standard license header
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.
Okay, I'll change this as well..
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, some small corrections, and please do not change the license headers
Changes for including flake8 in tests folder Signed-off-by: pravar <pravarag@gmail.com>
@yurishkuro, I've done the corrections and reverted back the changes to license headers. Please review. |
|
It seems these below lines were recently added in test_utils.py
That's why the build failed |
Nicely done! |
Thanks!! will continue contributing :-) |
Much appreciated (#235 - wink, wink). |
Formatted test scripts for jaeger-client-python as per the PEP8 guidelines for better readability.