Merge lp:~raharper/curtin/trunk.fix-tox-errors into lp:~curtin-dev/curtin/trunk

Proposed by Ryan Harper
Status: Merged
Merged at revision: 366
Proposed branch: lp:~raharper/curtin/trunk.fix-tox-errors
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 56 lines (+7/-7)
2 files modified
curtin/commands/main.py (+5/-5)
tox.ini (+2/-2)
To merge this branch: bzr merge lp:~raharper/curtin/trunk.fix-tox-errors
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Pending
Review via email: mp+290531@code.launchpad.net

Description of the change

curtin: fix tox errors in commands/main.py

Unexpectedly, pylint now blows up with the following errors:

E:208,13: Instance of 'argv' has no 'reportstack' member (but some types could
      not be inferred) (maybe-no-member)
E:209,18: Instance of 'argv' has no 'func' member (but some types could not be
      inferred) (maybe-no-member)

This code has been in tree for a very long time, this only shows up when
we added pylint to the tox run (revno 335). This should have always failed.

With that said, the fix is simple. In main(), we define args to be sys.argv
but it's not used until later we re-assign args to be something else from
argparser. Removing that useless initialization as a argv type resolves
the lint error.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :

I've just verified that what changed was a change in behavior from pylint from 1.5.4 to 1.5.5 (which was uploaded 2016-03-21) https://pypi.python.org/pypi/pylint .

this is the crux of using tox.
Its obnoxious when some upload somewhere on the internet starts breaking your c-i.

The thing we could do is set the version of pylint that is installed explicitly.
That can be done with something like:
=== modified file 'tox.ini'
--- tox.ini 2016-03-18 14:05:02 +0000
+++ tox.ini 2016-03-30 23:43:34 +0000
@@ -38,7 +38,7 @@
 # set basepython because tox 1.6 (trusty) does not support generated environments
 basepython = python3
 deps = {[testenv]deps}
- pylint
+ pylint==1.5.4
     bzr+lp:simplestreams
 commands = {envpython} -m pylint --errors-only {posargs:curtin tests/vmtests}

Revision history for this message
Scott Moser (smoser) wrote :

i'm ok with the change you suggest though.
The one thing is that when this code was put in, the intent was probably to allow args to be passed into main directly without the user having to modify sys.argv, but the code was lacking in doing that.

I suspect a patch like this would be more along the lines of what i intended, it also passes pylint.

http://paste.ubuntu.com/15564028/

Revision history for this message
Ryan Harper (raharper) wrote :

I'll likely take both your changes here once I can get vmtest to sync
images properly to my system for testing.

On Wed, Mar 30, 2016 at 6:55 PM, Scott Moser <email address hidden> wrote:

> i'm ok with the change you suggest though.
> The one thing is that when this code was put in, the intent was probably
> to allow args to be passed into main directly without the user having to
> modify sys.argv, but the code was lacking in doing that.
>
> I suspect a patch like this would be more along the lines of what i
> intended, it also passes pylint.
>
> http://paste.ubuntu.com/15564028/
> --
>
> https://code.launchpad.net/~raharper/curtin/trunk.fix-tox-errors/+merge/290531
> You are the owner of lp:~raharper/curtin/trunk.fix-tox-errors.
>

367. By Ryan Harper

Further fixes: specify pylint version and restore use-case of handling args

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'curtin/commands/main.py'
--- curtin/commands/main.py 2016-01-07 16:21:29 +0000
+++ curtin/commands/main.py 2016-03-31 00:55:53 +0000
@@ -117,9 +117,9 @@
117 return117 return
118118
119119
120def main(args=None):120def main(argv=None):
121 if args is None:121 if argv is None:
122 args = sys.argv122 argv = sys.argv[1:]
123123
124 stacktrace = (os.environ.get('CURTIN_STACKTRACE', "0").lower()124 stacktrace = (os.environ.get('CURTIN_STACKTRACE', "0").lower()
125 not in ("0", "false", ""))125 not in ("0", "false", ""))
@@ -129,7 +129,7 @@
129 except ValueError:129 except ValueError:
130 verbosity = 1130 verbosity = 1
131131
132 maybe_install_deps(sys.argv[1:], stacktrace=stacktrace,132 maybe_install_deps(argv, stacktrace=stacktrace,
133 verbosity=verbosity)133 verbosity=verbosity)
134134
135 # Above here, only standard library modules can be assumed.135 # Above here, only standard library modules can be assumed.
@@ -140,7 +140,7 @@
140 subps = parser.add_subparsers(dest="subcmd")140 subps = parser.add_subparsers(dest="subcmd")
141 for subcmd in SUB_COMMAND_MODULES:141 for subcmd in SUB_COMMAND_MODULES:
142 add_subcmd(subps, subcmd)142 add_subcmd(subps, subcmd)
143 args = parser.parse_args(sys.argv[1:])143 args = parser.parse_args(argv)
144144
145 # merge config flags into a single config dictionary145 # merge config flags into a single config dictionary
146 cfg_opts = args.main_cfgopts146 cfg_opts = args.main_cfgopts
147147
=== modified file 'tox.ini'
--- tox.ini 2016-03-18 14:05:02 +0000
+++ tox.ini 2016-03-31 00:55:53 +0000
@@ -38,7 +38,7 @@
38# set basepython because tox 1.6 (trusty) does not support generated environments38# set basepython because tox 1.6 (trusty) does not support generated environments
39basepython = python339basepython = python3
40deps = {[testenv]deps}40deps = {[testenv]deps}
41 pylint41 pylint==1.5.4
42 bzr+lp:simplestreams42 bzr+lp:simplestreams
43commands = {envpython} -m pylint --errors-only {posargs:curtin tests/vmtests}43commands = {envpython} -m pylint --errors-only {posargs:curtin tests/vmtests}
4444
@@ -46,7 +46,7 @@
46# set basepython because tox 1.6 (trusty) does not support generated environments46# set basepython because tox 1.6 (trusty) does not support generated environments
47basepython = python2.747basepython = python2.7
48deps = {[testenv]deps}48deps = {[testenv]deps}
49 pylint49 pylint==1.5.4
50commands = {envpython} -m pylint --errors-only {posargs:curtin}50commands = {envpython} -m pylint --errors-only {posargs:curtin}
5151
52[testenv:docs]52[testenv:docs]

Subscribers

People subscribed via source and target branches