-
Notifications
You must be signed in to change notification settings - Fork 180
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
Bug fixes, linting, drop python3.4 and Travis rework #255
Conversation
c73c43f
to
6fb53a0
Compare
Codecov Report
@@ Coverage Diff @@
## master #255 +/- ##
========================================
- Coverage 54.9% 54.5% -0.4%
========================================
Files 105 105
Lines 6229 6181 -48
========================================
- Hits 3424 3374 -50
- Misses 2805 2807 +2
Continue to review full report at Codecov.
|
6fb53a0
to
3925355
Compare
Do you have any idea why coverages takes a nosedive? |
Yes, this is mostly caused by "drop python3.4 support" and "linting: do miscellaneous linting". These commits remove lines, either by dropping the |
ef0d912
to
731ed8c
Compare
|
731ed8c
to
a8959d9
Compare
|
a8959d9
to
af5a4fe
Compare
|
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 leave out the tox-related changes for now. I'd like to do my own experiments with it first.
labgrid/autoinstall/main.py
Outdated
@@ -73,7 +73,7 @@ def run(self): | |||
self.context['target'] = self.target | |||
if self.target is None: | |||
raise KeyError | |||
except: | |||
except KeyError: |
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.
Other exceptions can be generated by env.get_target() during target creation, which should also be caught by this catch all.
labgrid/target.py
Outdated
""" | ||
Helper function to get a resource of the target. | ||
Returns the first valid resource found, otherwise None. | ||
|
||
Arguments: | ||
cls -- resource-class to return as a resource | ||
name -- optional name to use as a filter | ||
await -- wait for the resource to become available (default True) | ||
wait_for -- wait for the resource to become available (default 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'd prefer wait_avail instead of wait_for. wait_for suggests that you need to pass the thing you want to wait for.
labgrid/remote/exporter.py
Outdated
@@ -381,13 +381,9 @@ def onChallenge(self, challenge): | |||
self.loop.stop() | |||
|
|||
async def acquire(self, group_name, resource_name): | |||
resource = self.groups[group_name][resource_name] |
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 (and the one below) should actually be TODOs. We want to be able to perform local actions when a resource is acquired, and this would be the correct place when we get around to that.
labgrid/driver/shelldriver.py
Outdated
@@ -61,13 +61,14 @@ def on_activate(self): | |||
self._inject_run() | |||
if self.keyfile: | |||
self._put_ssh_key(self.keyfile) | |||
self._run("dmesg -n 1") # Turn off Kernel Messages to the console | |||
# Turn off Kernel Messages to the console | |||
self._run("dmesg -n 1") # pylint: disable=missing-kwoa |
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 disable missing-kwoa and unused-argument for the whole file. The annotations are too noisy.
labgrid/remote/common.py
Outdated
@@ -103,8 +103,8 @@ class Place: | |||
acquired = attr.ib(default=None) | |||
acquired_resources = attr.ib(default=attr.Factory(list)) | |||
allowed = attr.ib(default=attr.Factory(set), convert=set) | |||
created = attr.ib(default=attr.Factory(lambda: time.time())) | |||
changed = attr.ib(default=attr.Factory(lambda: time.time())) | |||
created = attr.ib(default=attr.Factory(lambda: time.time())) # pylint: disable=unnecessary-lambda |
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 message seems correct, we should just use Factory(time.time).
labgrid/remote/common.py
Outdated
@@ -16,27 +16,27 @@ def __attrs_post_init__(self): | |||
|
|||
@property | |||
def avail(self): | |||
return self.data['avail'] | |||
return self.data['avail'] # pylint: disable=unsubscriptable-object |
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.
Disable this for the whole file.
…erFoundError Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
The attr property is a duplicate of the property method with the same name. As this property is not intended to be given to the init method, remove it. Signed-off-by: Bastian Stender <bst@pengutronix.de>
Prevent overwriting built-in function vars(). Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
This was propably a copy/paste error. Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
There is no need to use the list type constructor for "args". "args" is alreay a list. Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
This is useful for debugging. Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Do not use mutable values as dangerous default values for arguments. See pylint W0102 error message. Signed-off-by: Bastian Stender <bst@pengutronix.de>
It is enough to just iterate through the dictionary itself, as in: for key in dictionary: pass Signed-off-by: Bastian Stender <bst@pengutronix.de>
"resource" should only be used in the loop and not lateron. Use the resource name from the method argument instead. Signed-off-by: Bastian Stender <bst@pengutronix.de>
See pylint error messag C0123. Signed-off-by: Bastian Stender <bst@pengutronix.de>
Order imports: standard libraries followed by external libraries followed by local imports Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
See pylint error messages R1705 and R1710. Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Instead of comparing the length to 0, rely on the fact that empty sequences are False. Signed-off-by: Bastian Stender <bst@pengutronix.de>
"await" will become a keyword in Python 3.7. Signed-off-by: Bastian Stender <bst@pengutronix.de>
In case unpacking gets complicated use _ for unused variables. Signed-off-by: Bastian Stender <bst@pengutronix.de>
See pylint error messge W1201. Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
Signed-off-by: Bastian Stender <bst@pengutronix.de>
This makes travis stall in case the diff is big enough that git decides to display it in a pager. Signed-off-by: Bastian Stender <bst@pengutronix.de>
af5a4fe
to
ed61360
Compare
|
This PR includes several bug fixes. These bugs were found while using pylint. To be more consistent in coding style fix most of the linting warnings and all errors. Some warnings were left out, because the fix is either not obvious or time consuming. This is work tbd.
While at it python3.4 support was dropped.
Finally Travis-CI should check for linting errors to prevent those bugs from now on.
I think more warnings and errors should be ignored, but we need a separate discussion for that. Some warnings are caused by pylint not recognizing attr behavior. Discussion happens in #257.