Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Fully Migrate to Python 3 and cleanup some dead code #104

Merged
merged 10 commits into from
Jan 1, 2020

Conversation

vfreex
Copy link
Contributor

@vfreex vfreex commented Dec 28, 2019

Fully Migrate to Python 3 and cleanup some dead code

This PR is based on #85 and futurize.

I carefully reviewed all code changes introduced by #85 and the futurize tool,
manually fixed all issues I noticed.

During the review process, I also deleted a lot of dead code and fixed some minor bugs in the codebase.
I also tested this PR with the functional test suite #105.

This PR will also bump the version to 1.0.0-rc.1 (Wouldn't it be nice to have version >= 1?)
and prompt a warning message like pip if Elliott is running with Python 2:

$ python2 ./elliott --version
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of Elliott will drop support for Python 2.7.
Elliott v1.0.0-rc.1
Python v2.7.17 (default, Oct 21 2019, 17:20:57) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

@sosiouxme @tbielawa @shiywang @thiagoalessio @joepvd Could you guys help review this change?

vfreex and others added 9 commits December 29, 2019 06:11
This branch is used for Python 3 migration. Python 3 test is enabled on this branch.
We periodically synchronize the master with this branch until we get everything working on Python 3.
in python3 iteritems became items
in python2 unless you have a large dict items() is just fine for usage

https://python-future.org/compatible_idioms.html#iterating-through-dict-keys-values-items

Related: issue openshift-eng#84
urlparse was combined into urllib and can be imported from there

https://python-future.org/compatible_idioms.html#urllib-module

this approach was already present in other files

Related: issue openshift-eng#84
This appears to be related to the python 2 vs 3 differences in how it handles strings

Related: issue openshift-eng#84
python3 appears to have different behavior for exceptions and how to expose them in modules

Related: issue openshift-eng#84
print in py3 changed into a function

Related: issue openshift-eng#84
@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 28, 2019
@vfreex vfreex force-pushed the py3-stage2 branch 2 times, most recently from 09ac055 to 9b2c0d6 Compare December 29, 2019 13:27
@vfreex vfreex changed the title WIP: Fully support Python 3 and remove dead code Fully Migrate to Python 3 and cleanup some dead code Dec 29, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 29, 2019
@openshift-bot
Copy link

Build #2

GLOB sdist-make: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/setup.py
py3 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/.tox/.tmp/package/1/rh-elliott-1.0.0rc1.zip
py3 installed: astroid==2.3.3,attrs==19.3.0,autopep8==1.4.4,bashlex==0.14,certifi==2019.11.28,cffi==1.13.2,chardet==3.0.4,Click==7.0,coverage==5.0.1,cryptography==2.8,decorator==4.4.1,dockerfile-parse==0.0.15,entrypoints==0.3,errata-tool==1.20.0,filelock==3.0.12,flake8==3.7.9,flexmock==0.10.4,future==0.18.2,idna==2.8,importlib-metadata==1.3.0,isort==4.3.21,jsonpath-rw==1.4.0,kerberos==1.3.0,koji==1.19.1,lazy-object-proxy==1.4.3,mccabe==0.6.1,mock==3.0.5,more-itertools==8.0.2,packaging==19.2,pluggy==0.13.1,ply==3.11,py==1.8.1,pycodestyle==2.5.0,pycparser==2.19,pyflakes==2.1.1,pygit2==0.28.2,pykerberos==1.2.1,pylint==2.4.4,pyOpenSSL==19.1.0,pyparsing==2.4.6,pytest==5.3.2,python-bugzilla==2.3.0,python-dateutil==2.8.1,PyYAML==5.2,requests==2.22.0,requests-kerberos==0.12.0,rh-elliott==1.0.0rc1,rpm==4.14.2,rpm-py-installer==1.0.0,six==1.13.0,toml==0.10.0,tox==3.14.3,typed-ast==1.4.0,typing==3.7.4.1,typing-extensions==3.7.4.1,urllib3==1.25.7,virtualenv==16.7.9,wcwidth==0.1.7,wrapt==1.11.2,zipp==0.6.0
py3 run-test-pre: PYTHONHASHSEED='240418505'
py3 run-test: commands[0] | flake8
py3 run-test: commands[1] | coverage run --branch --source elliott,elliottlib -m unittest discover
..........................Found flaw bug with no alias, this can happen is a flaw hasn't been assigned a CVE
.Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Warning: found tracker bugs which doesn't block any other bugs
.CVE impact couldn't be determined for tracking bug 123, defaulting to Low.
............./mnt/workspace/jenkins/working/art-tools_elliott_PR-104/tests/test_exectools.py:36: DeprecationWarning: Please use assertRaisesRegex instead.
  Exception, self.ERROR_MSG.format(1), exectools.retry, 1, fail_function)
......................
----------------------------------------------------------------------
Ran 63 tests in 0.073s

OK
Coverage.py warning: Module elliott was never imported. (module-not-imported)
py3 run-test: commands[2] | coverage report
Name                                       Stmts   Miss Branch BrPart  Cover
----------------------------------------------------------------------------
elliottlib/__init__.py                         6      3      0      0    50%
elliottlib/assertion.py                       20      4      6      0    85%
elliottlib/brew.py                           159     41     46      4    69%
elliottlib/bzutil.py                         196     93     88      3    52%
elliottlib/cli/__init__.py                     0      0      0      0   100%
elliottlib/cli/__main__.py                   396    396    142      0     0%
elliottlib/cli/add_metadata_cli.py            33     33      4      0     0%
elliottlib/cli/advisory_images_cli.py         13     13      2      0     0%
elliottlib/cli/cli_opts.py                    12      0     13      0   100%
elliottlib/cli/common.py                      39     16      6      0    51%
elliottlib/cli/create_cli.py                  90     90     38      0     0%
elliottlib/cli/create_placeholder_cli.py      46     46     10      0     0%
elliottlib/cli/find_builds_cli.py            136     90     74      3    27%
elliottlib/cli/list_cli.py                    17     17      4      0     0%
elliottlib/cli/puddle_advisories_cli.py       38     38     10      0     0%
elliottlib/cli/rpmdiff_cli.py                 81     81     28      0     0%
elliottlib/cli/tarball_sources_cli.py         82     82     26      0     0%
elliottlib/constants.py                       37      0      0      0   100%
elliottlib/dotconfig.py                       55     44     32      0    13%
elliottlib/errata.py                         140     74     56      4    42%
elliottlib/exceptions.py                      13      0      0      0   100%
elliottlib/exectools.py                       50      3     18      2    93%
elliottlib/gitdata.py                        161    132     76      0    12%
elliottlib/imagecfg.py                        23      9      2      0    56%
elliottlib/logutil.py                         10      1      2      1    83%
elliottlib/metadata.py                        72     28     20      3    51%
elliottlib/model.py                          144     85     62      4    33%
elliottlib/openshiftclient.py                 42     42      8      0     0%
elliottlib/pushd.py                           21      0      2      0   100%
elliottlib/rpmdiff.py                         32      0      0      0   100%
elliottlib/runtime.py                        163    124     58      0    18%
elliottlib/tarball_sources.py                101     61     38      0    37%
elliottlib/util.py                            84     44     10      0    47%
----------------------------------------------------------------------------
TOTAL                                       2512   1690    881     24    29%
py27 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/.tox/.tmp/package/1/rh-elliott-1.0.0rc1.zip
py27 installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support,astroid==1.6.6,atomicwrites==1.3.0,attrs==19.3.0,autopep8==1.4.4,backports.functools-lru-cache==1.6.1,bashlex==0.14,certifi==2019.11.28,cffi==1.13.2,chardet==3.0.4,Click==7.0,configparser==4.0.2,contextlib2==0.6.0.post1,coverage==5.0.1,cryptography==2.8,decorator==4.4.1,dockerfile-parse==0.0.15,entrypoints==0.3,enum34==1.1.6,errata-tool==1.20.0,filelock==3.0.12,flake8==3.7.9,flexmock==0.10.4,funcsigs==1.0.2,functools32==3.2.3.post2,future==0.18.2,futures==3.3.0,idna==2.8,importlib-metadata==1.3.0,ipaddress==1.0.23,isort==4.3.21,jsonpath-rw==1.4.0,kerberos==1.3.0,koji==1.19.1,lazy-object-proxy==1.4.3,mccabe==0.6.1,mock==3.0.5,more-itertools==5.0.0,packaging==19.2,pathlib2==2.3.5,pluggy==0.13.1,ply==3.11,py==1.8.1,pycodestyle==2.5.0,pycparser==2.19,pyflakes==2.1.1,pygit2==0.28.2,pykerberos==1.2.1,pylint==1.9.5,pyOpenSSL==19.1.0,pyparsing==2.4.6,pytest==4.6.8,python-bugzilla==2.3.0,python-dateutil==2.8.1,python-krbV==1.0.90,PyYAML==5.2,requests==2.22.0,requests-kerberos==0.12.0,rh-elliott==1.0.0rc1,rpm==4.14.2,rpm-py-installer==1.0.0,scandir==1.10.0,singledispatch==3.4.0.3,six==1.13.0,toml==0.10.0,tox==3.14.3,typing==3.7.4.1,typing-extensions==3.7.4.1,urllib3==1.25.7,virtualenv==16.7.9,wcwidth==0.1.7,wrapt==1.11.2,zipp==0.6.0
py27 run-test-pre: PYTHONHASHSEED='240418505'
py27 run-test: commands[0] | flake8
py27 run-test: commands[1] | coverage run --branch --source elliott,elliottlib -m unittest discover
...........................................No handlers could be found for logger "ocp_cd_tools.elliottlib.bzutil"
.Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Warning: found tracker bugs which doesn't block any other bugs
...................
----------------------------------------------------------------------
Ran 63 tests in 0.113s

OK
Coverage.py warning: Module elliott was never imported. (module-not-imported)
py27 run-test: commands[2] | coverage report
Name                                       Stmts   Miss Branch BrPart  Cover
----------------------------------------------------------------------------
elliottlib/__init__.py                         6      3      0      0    50%
elliottlib/assertion.py                       20      0      6      0   100%
elliottlib/brew.py                           159     41     40      4    69%
elliottlib/bzutil.py                         196     93     76      3    54%
elliottlib/cli/__init__.py                     0      0      0      0   100%
elliottlib/cli/__main__.py                   396    396    128      0     0%
elliottlib/cli/add_metadata_cli.py            33     33      4      0     0%
elliottlib/cli/advisory_images_cli.py         13     13      2      0     0%
elliottlib/cli/cli_opts.py                    12      0      8      0   100%
elliottlib/cli/common.py                      39     16      6      0    51%
elliottlib/cli/create_cli.py                  90     90     34      0     0%
elliottlib/cli/create_placeholder_cli.py      46     46     10      0     0%
elliottlib/cli/find_builds_cli.py            136     90     68      3    28%
elliottlib/cli/list_cli.py                    17     17      4      0     0%
elliottlib/cli/puddle_advisories_cli.py       38     38     10      0     0%
elliottlib/cli/rpmdiff_cli.py                 81     81     28      0     0%
elliottlib/cli/tarball_sources_cli.py         82     82     24      0     0%
elliottlib/constants.py                       37      0      0      0   100%
elliottlib/dotconfig.py                       55     44     32      0    13%
elliottlib/errata.py                         140     74     48      4    40%
elliottlib/exceptions.py                      13      0      0      0   100%
elliottlib/exectools.py                       50      3     18      2    93%
elliottlib/gitdata.py                        161    132     74      0    12%
elliottlib/imagecfg.py                        23      9      2      0    56%
elliottlib/logutil.py                         10      1      2      1    83%
elliottlib/metadata.py                        72     28     20      3    51%
elliottlib/model.py                          144     85     62      4    33%
elliottlib/openshiftclient.py                 42     42      8      0     0%
elliottlib/pushd.py                           21      0      2      0   100%
elliottlib/rpmdiff.py                         32      0      0      0   100%
elliottlib/runtime.py                        163    124     54      0    18%
elliottlib/tarball_sources.py                101     61     34      0    36%
elliottlib/util.py                            84     44     10      0    47%
----------------------------------------------------------------------------
TOTAL                                       2512   1686    814     24    29%
___________________________________ summary ____________________________________
  py3: commands succeeded
  py27: commands succeeded
  congratulations :)

@openshift-eng openshift-eng deleted a comment from openshift-bot Dec 29, 2019
@shiywang
Copy link

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 31, 2019
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Dec 31, 2019
@openshift-bot
Copy link

Build #3

GLOB sdist-make: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/setup.py
py3 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/.tox/.tmp/package/1/rh-elliott-1.0.0rc1.zip
py3 installed: astroid==2.3.3,attrs==19.3.0,autopep8==1.4.4,bashlex==0.14,certifi==2019.11.28,cffi==1.13.2,chardet==3.0.4,Click==7.0,coverage==5.0.1,cryptography==2.8,decorator==4.4.1,dockerfile-parse==0.0.15,entrypoints==0.3,errata-tool==1.20.0,filelock==3.0.12,flake8==3.7.9,flexmock==0.10.4,future==0.18.2,idna==2.8,importlib-metadata==1.3.0,isort==4.3.21,jsonpath-rw==1.4.0,kerberos==1.3.0,koji==1.19.1,lazy-object-proxy==1.4.3,mccabe==0.6.1,mock==3.0.5,more-itertools==8.0.2,packaging==19.2,pluggy==0.13.1,ply==3.11,py==1.8.1,pycodestyle==2.5.0,pycparser==2.19,pyflakes==2.1.1,pygit2==0.28.2,pykerberos==1.2.1,pylint==2.4.4,pyOpenSSL==19.1.0,pyparsing==2.4.6,pytest==5.3.2,python-bugzilla==2.3.0,python-dateutil==2.8.1,PyYAML==5.2,requests==2.22.0,requests-kerberos==0.12.0,rh-elliott==1.0.0rc1,rpm==4.14.2,rpm-py-installer==1.0.0,six==1.13.0,toml==0.10.0,tox==3.14.3,typed-ast==1.4.0,typing==3.7.4.1,typing-extensions==3.7.4.1,urllib3==1.25.7,virtualenv==16.7.9,wcwidth==0.1.7,wrapt==1.11.2,zipp==0.6.0
py3 run-test-pre: PYTHONHASHSEED='2992662251'
py3 run-test: commands[0] | flake8
py3 run-test: commands[1] | coverage run --branch --source elliott,elliottlib -m unittest discover
..........................Found flaw bug with no alias, this can happen is a flaw hasn't been assigned a CVE
.Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Warning: found tracker bugs which doesn't block any other bugs
.CVE impact couldn't be determined for tracking bug 123, defaulting to Low.
...................................
----------------------------------------------------------------------
Ran 63 tests in 0.081s

OK
Coverage.py warning: Module elliott was never imported. (module-not-imported)
py3 run-test: commands[2] | coverage report
Name                                       Stmts   Miss Branch BrPart  Cover
----------------------------------------------------------------------------
elliottlib/__init__.py                         6      3      0      0    50%
elliottlib/assertion.py                       20      4      6      0    85%
elliottlib/brew.py                           159     41     46      4    69%
elliottlib/bzutil.py                         196     93     88      3    52%
elliottlib/cli/__init__.py                     0      0      0      0   100%
elliottlib/cli/__main__.py                   396    396    142      0     0%
elliottlib/cli/add_metadata_cli.py            33     33      4      0     0%
elliottlib/cli/advisory_images_cli.py         13     13      2      0     0%
elliottlib/cli/cli_opts.py                    12      0     13      0   100%
elliottlib/cli/common.py                      39     16      6      0    51%
elliottlib/cli/create_cli.py                  90     90     38      0     0%
elliottlib/cli/create_placeholder_cli.py      46     46     10      0     0%
elliottlib/cli/find_builds_cli.py            136     90     74      3    27%
elliottlib/cli/list_cli.py                    17     17      4      0     0%
elliottlib/cli/puddle_advisories_cli.py       38     38     10      0     0%
elliottlib/cli/rpmdiff_cli.py                 81     81     28      0     0%
elliottlib/cli/tarball_sources_cli.py         82     82     26      0     0%
elliottlib/constants.py                       37      0      0      0   100%
elliottlib/dotconfig.py                       55     44     32      0    13%
elliottlib/errata.py                         140     74     56      4    42%
elliottlib/exceptions.py                      13      0      0      0   100%
elliottlib/exectools.py                       50      3     18      2    93%
elliottlib/gitdata.py                        161    132     76      0    12%
elliottlib/imagecfg.py                        23      9      2      0    56%
elliottlib/logutil.py                         10      1      2      1    83%
elliottlib/metadata.py                        72     28     20      3    51%
elliottlib/model.py                          103     50     30      4    46%
elliottlib/openshiftclient.py                 42     42      8      0     0%
elliottlib/pushd.py                           21      0      2      0   100%
elliottlib/rpmdiff.py                         32      0      0      0   100%
elliottlib/runtime.py                        163    124     58      0    18%
elliottlib/tarball_sources.py                101     61     38      0    37%
elliottlib/util.py                            84     44     10      0    47%
----------------------------------------------------------------------------
TOTAL                                       2471   1655    849     24    29%
py27 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/.tox/.tmp/package/1/rh-elliott-1.0.0rc1.zip
py27 installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support,astroid==1.6.6,atomicwrites==1.3.0,attrs==19.3.0,autopep8==1.4.4,backports.functools-lru-cache==1.6.1,bashlex==0.14,certifi==2019.11.28,cffi==1.13.2,chardet==3.0.4,Click==7.0,configparser==4.0.2,contextlib2==0.6.0.post1,coverage==5.0.1,cryptography==2.8,decorator==4.4.1,dockerfile-parse==0.0.15,entrypoints==0.3,enum34==1.1.6,errata-tool==1.20.0,filelock==3.0.12,flake8==3.7.9,flexmock==0.10.4,funcsigs==1.0.2,functools32==3.2.3.post2,future==0.18.2,futures==3.3.0,idna==2.8,importlib-metadata==1.3.0,ipaddress==1.0.23,isort==4.3.21,jsonpath-rw==1.4.0,kerberos==1.3.0,koji==1.19.1,lazy-object-proxy==1.4.3,mccabe==0.6.1,mock==3.0.5,more-itertools==5.0.0,packaging==19.2,pathlib2==2.3.5,pluggy==0.13.1,ply==3.11,py==1.8.1,pycodestyle==2.5.0,pycparser==2.19,pyflakes==2.1.1,pygit2==0.28.2,pykerberos==1.2.1,pylint==1.9.5,pyOpenSSL==19.1.0,pyparsing==2.4.6,pytest==4.6.8,python-bugzilla==2.3.0,python-dateutil==2.8.1,python-krbV==1.0.90,PyYAML==5.2,requests==2.22.0,requests-kerberos==0.12.0,rh-elliott==1.0.0rc1,rpm==4.14.2,rpm-py-installer==1.0.0,scandir==1.10.0,singledispatch==3.4.0.3,six==1.13.0,toml==0.10.0,tox==3.14.3,typing==3.7.4.1,typing-extensions==3.7.4.1,urllib3==1.25.7,virtualenv==16.7.9,wcwidth==0.1.7,wrapt==1.11.2,zipp==0.6.0
py27 run-test-pre: PYTHONHASHSEED='2992662251'
py27 run-test: commands[0] | flake8
py27 run-test: commands[1] | coverage run --branch --source elliott,elliottlib -m unittest discover
...........................................No handlers could be found for logger "ocp_cd_tools.elliottlib.bzutil"
.Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Warning: found tracker bugs which doesn't block any other bugs
...................
----------------------------------------------------------------------
Ran 63 tests in 0.092s

OK
Coverage.py warning: Module elliott was never imported. (module-not-imported)
py27 run-test: commands[2] | coverage report
Name                                       Stmts   Miss Branch BrPart  Cover
----------------------------------------------------------------------------
elliottlib/__init__.py                         6      3      0      0    50%
elliottlib/assertion.py                       20      0      6      0   100%
elliottlib/brew.py                           159     41     40      4    69%
elliottlib/bzutil.py                         196     93     76      3    54%
elliottlib/cli/__init__.py                     0      0      0      0   100%
elliottlib/cli/__main__.py                   396    396    128      0     0%
elliottlib/cli/add_metadata_cli.py            33     33      4      0     0%
elliottlib/cli/advisory_images_cli.py         13     13      2      0     0%
elliottlib/cli/cli_opts.py                    12      0      8      0   100%
elliottlib/cli/common.py                      39     16      6      0    51%
elliottlib/cli/create_cli.py                  90     90     34      0     0%
elliottlib/cli/create_placeholder_cli.py      46     46     10      0     0%
elliottlib/cli/find_builds_cli.py            136     90     68      3    28%
elliottlib/cli/list_cli.py                    17     17      4      0     0%
elliottlib/cli/puddle_advisories_cli.py       38     38     10      0     0%
elliottlib/cli/rpmdiff_cli.py                 81     81     28      0     0%
elliottlib/cli/tarball_sources_cli.py         82     82     24      0     0%
elliottlib/constants.py                       37      0      0      0   100%
elliottlib/dotconfig.py                       55     44     32      0    13%
elliottlib/errata.py                         140     74     48      4    40%
elliottlib/exceptions.py                      13      0      0      0   100%
elliottlib/exectools.py                       50      3     18      2    93%
elliottlib/gitdata.py                        161    132     74      0    12%
elliottlib/imagecfg.py                        23      9      2      0    56%
elliottlib/logutil.py                         10      1      2      1    83%
elliottlib/metadata.py                        72     28     20      3    51%
elliottlib/model.py                          103     50     30      4    46%
elliottlib/openshiftclient.py                 42     42      8      0     0%
elliottlib/pushd.py                           21      0      2      0   100%
elliottlib/rpmdiff.py                         32      0      0      0   100%
elliottlib/runtime.py                        163    124     54      0    18%
elliottlib/tarball_sources.py                101     61     34      0    36%
elliottlib/util.py                            84     44     10      0    47%
----------------------------------------------------------------------------
TOTAL                                       2471   1651    782     24    30%
___________________________________ summary ____________________________________
  py3: commands succeeded
  py27: commands succeeded
  congratulations :)

This PR is based on openshift-eng#85 and [futurize][].

I carefully reviewed all code changes introduced by openshift-eng#85 and the `futurize` tool,
manually fixed all issues I noticed.

During the review process, I also deleted a lot of dead code in the codebase.
I also tested this PR with the functional test suite openshift-eng#105.

[futurize]: futurize
@openshift-bot
Copy link

Build #4

GLOB sdist-make: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/setup.py
py3 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/.tox/.tmp/package/1/rh-elliott-1.0.0rc1.zip
py3 installed: astroid==2.3.3,attrs==19.3.0,autopep8==1.4.4,bashlex==0.14,certifi==2019.11.28,cffi==1.13.2,chardet==3.0.4,Click==7.0,coverage==5.0.1,cryptography==2.8,decorator==4.4.1,dockerfile-parse==0.0.15,entrypoints==0.3,errata-tool==1.20.0,filelock==3.0.12,flake8==3.7.9,flexmock==0.10.4,future==0.18.2,idna==2.8,importlib-metadata==1.3.0,isort==4.3.21,jsonpath-rw==1.4.0,kerberos==1.3.0,koji==1.19.1,lazy-object-proxy==1.4.3,mccabe==0.6.1,mock==3.0.5,more-itertools==8.0.2,packaging==19.2,pluggy==0.13.1,ply==3.11,py==1.8.1,pycodestyle==2.5.0,pycparser==2.19,pyflakes==2.1.1,pygit2==0.28.2,pykerberos==1.2.1,pylint==2.4.4,pyOpenSSL==19.1.0,pyparsing==2.4.6,pytest==5.3.2,python-bugzilla==2.3.0,python-dateutil==2.8.1,PyYAML==5.2,requests==2.22.0,requests-kerberos==0.12.0,rh-elliott==1.0.0rc1,rpm==4.14.2,rpm-py-installer==1.0.0,six==1.13.0,toml==0.10.0,tox==3.14.3,typed-ast==1.4.0,typing==3.7.4.1,typing-extensions==3.7.4.1,urllib3==1.25.7,virtualenv==16.7.9,wcwidth==0.1.7,wrapt==1.11.2,zipp==0.6.0
py3 run-test-pre: PYTHONHASHSEED='1429570968'
py3 run-test: commands[0] | flake8
py3 run-test: commands[1] | coverage run --branch --source elliott,elliottlib -m unittest discover
..........................Found flaw bug with no alias, this can happen is a flaw hasn't been assigned a CVE
.Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Warning: found tracker bugs which doesn't block any other bugs
.CVE impact couldn't be determined for tracking bug 123, defaulting to Low.
...................................
----------------------------------------------------------------------
Ran 63 tests in 0.063s

OK
Coverage.py warning: Module elliott was never imported. (module-not-imported)
py3 run-test: commands[2] | coverage report
Name                                       Stmts   Miss Branch BrPart  Cover
----------------------------------------------------------------------------
elliottlib/__init__.py                         6      3      0      0    50%
elliottlib/assertion.py                       20      4      6      0    85%
elliottlib/brew.py                           159     41     46      4    69%
elliottlib/bzutil.py                         196     93     88      3    52%
elliottlib/cli/__init__.py                     0      0      0      0   100%
elliottlib/cli/__main__.py                   396    396    142      0     0%
elliottlib/cli/add_metadata_cli.py            33     33      4      0     0%
elliottlib/cli/advisory_images_cli.py         13     13      2      0     0%
elliottlib/cli/cli_opts.py                    12      0     13      0   100%
elliottlib/cli/common.py                      39     16      6      0    51%
elliottlib/cli/create_cli.py                  90     90     38      0     0%
elliottlib/cli/create_placeholder_cli.py      46     46     10      0     0%
elliottlib/cli/find_builds_cli.py            136     90     74      3    27%
elliottlib/cli/list_cli.py                    17     17      4      0     0%
elliottlib/cli/puddle_advisories_cli.py       38     38     10      0     0%
elliottlib/cli/rpmdiff_cli.py                 81     81     28      0     0%
elliottlib/cli/tarball_sources_cli.py         82     82     26      0     0%
elliottlib/constants.py                       37      0      0      0   100%
elliottlib/dotconfig.py                       55     44     32      0    13%
elliottlib/errata.py                         140     74     56      4    42%
elliottlib/exceptions.py                      13      0      0      0   100%
elliottlib/exectools.py                       50      3     18      2    93%
elliottlib/gitdata.py                        161    132     76      0    12%
elliottlib/imagecfg.py                        23      9      2      0    56%
elliottlib/logutil.py                         10      1      2      1    83%
elliottlib/metadata.py                        72     28     20      3    51%
elliottlib/model.py                          103     50     30      4    46%
elliottlib/openshiftclient.py                 42     42      8      0     0%
elliottlib/pushd.py                           21      0      2      0   100%
elliottlib/rpmdiff.py                         32      0      0      0   100%
elliottlib/runtime.py                        163    124     58      0    18%
elliottlib/tarball_sources.py                101     61     38      0    37%
elliottlib/util.py                            84     44     10      0    47%
----------------------------------------------------------------------------
TOTAL                                       2471   1655    849     24    29%
py27 inst-nodeps: /mnt/workspace/jenkins/working/art-tools_elliott_PR-104/.tox/.tmp/package/1/rh-elliott-1.0.0rc1.zip
py27 installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support,astroid==1.6.6,atomicwrites==1.3.0,attrs==19.3.0,autopep8==1.4.4,backports.functools-lru-cache==1.6.1,bashlex==0.14,certifi==2019.11.28,cffi==1.13.2,chardet==3.0.4,Click==7.0,configparser==4.0.2,contextlib2==0.6.0.post1,coverage==5.0.1,cryptography==2.8,decorator==4.4.1,dockerfile-parse==0.0.15,entrypoints==0.3,enum34==1.1.6,errata-tool==1.20.0,filelock==3.0.12,flake8==3.7.9,flexmock==0.10.4,funcsigs==1.0.2,functools32==3.2.3.post2,future==0.18.2,futures==3.3.0,idna==2.8,importlib-metadata==1.3.0,ipaddress==1.0.23,isort==4.3.21,jsonpath-rw==1.4.0,kerberos==1.3.0,koji==1.19.1,lazy-object-proxy==1.4.3,mccabe==0.6.1,mock==3.0.5,more-itertools==5.0.0,packaging==19.2,pathlib2==2.3.5,pluggy==0.13.1,ply==3.11,py==1.8.1,pycodestyle==2.5.0,pycparser==2.19,pyflakes==2.1.1,pygit2==0.28.2,pykerberos==1.2.1,pylint==1.9.5,pyOpenSSL==19.1.0,pyparsing==2.4.6,pytest==4.6.8,python-bugzilla==2.3.0,python-dateutil==2.8.1,python-krbV==1.0.90,PyYAML==5.2,requests==2.22.0,requests-kerberos==0.12.0,rh-elliott==1.0.0rc1,rpm==4.14.2,rpm-py-installer==1.0.0,scandir==1.10.0,singledispatch==3.4.0.3,six==1.13.0,toml==0.10.0,tox==3.14.3,typing==3.7.4.1,typing-extensions==3.7.4.1,urllib3==1.25.7,virtualenv==16.7.9,wcwidth==0.1.7,wrapt==1.11.2,zipp==0.6.0
py27 run-test-pre: PYTHONHASHSEED='1429570968'
py27 run-test: commands[0] | flake8
py27 run-test: commands[1] | coverage run --branch --source elliott,elliottlib -m unittest discover
...........................................No handlers could be found for logger "ocp_cd_tools.elliottlib.bzutil"
.Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Refreshing for tag: rhaos-3.9-rhel-7-candidate
Warning: found tracker bugs which doesn't block any other bugs
...................
----------------------------------------------------------------------
Ran 63 tests in 0.092s

OK
Coverage.py warning: Module elliott was never imported. (module-not-imported)
py27 run-test: commands[2] | coverage report
Name                                       Stmts   Miss Branch BrPart  Cover
----------------------------------------------------------------------------
elliottlib/__init__.py                         6      3      0      0    50%
elliottlib/assertion.py                       20      0      6      0   100%
elliottlib/brew.py                           159     41     40      4    69%
elliottlib/bzutil.py                         196     93     76      3    54%
elliottlib/cli/__init__.py                     0      0      0      0   100%
elliottlib/cli/__main__.py                   396    396    128      0     0%
elliottlib/cli/add_metadata_cli.py            33     33      4      0     0%
elliottlib/cli/advisory_images_cli.py         13     13      2      0     0%
elliottlib/cli/cli_opts.py                    12      0      8      0   100%
elliottlib/cli/common.py                      39     16      6      0    51%
elliottlib/cli/create_cli.py                  90     90     34      0     0%
elliottlib/cli/create_placeholder_cli.py      46     46     10      0     0%
elliottlib/cli/find_builds_cli.py            136     90     68      3    28%
elliottlib/cli/list_cli.py                    17     17      4      0     0%
elliottlib/cli/puddle_advisories_cli.py       38     38     10      0     0%
elliottlib/cli/rpmdiff_cli.py                 81     81     28      0     0%
elliottlib/cli/tarball_sources_cli.py         82     82     24      0     0%
elliottlib/constants.py                       37      0      0      0   100%
elliottlib/dotconfig.py                       55     44     32      0    13%
elliottlib/errata.py                         140     74     48      4    40%
elliottlib/exceptions.py                      13      0      0      0   100%
elliottlib/exectools.py                       50      3     18      2    93%
elliottlib/gitdata.py                        161    132     74      0    12%
elliottlib/imagecfg.py                        23      9      2      0    56%
elliottlib/logutil.py                         10      1      2      1    83%
elliottlib/metadata.py                        72     28     20      3    51%
elliottlib/model.py                          103     50     30      4    46%
elliottlib/openshiftclient.py                 42     42      8      0     0%
elliottlib/pushd.py                           21      0      2      0   100%
elliottlib/rpmdiff.py                         32      0      0      0   100%
elliottlib/runtime.py                        163    124     54      0    18%
elliottlib/tarball_sources.py                101     61     34      0    36%
elliottlib/util.py                            84     44     10      0    47%
----------------------------------------------------------------------------
TOTAL                                       2471   1651    782     24    30%
___________________________________ summary ____________________________________
  py3: commands succeeded
  py27: commands succeeded
  congratulations :)

@shiywang shiywang merged commit b4ec77d into openshift-eng:master Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants