[PATCH] 007 In-tree tests and linting with tox
Hi, I don't like the fact that building and testing the Python part of PKI takes so long. I have been using tox and a custom setup.py for a couple of days now. The tox tool automates source distribution, virtual envs and testing. It makes it really easy to achieve a minium level of confidence, that the Python code is correct, in a matter of seconds. The patch is related to https://fedorahosted.org/pki/ticket/696 and https://fedorahosted.org/pki/ticket/708. How to use tox: $ sudo dnf install python-tox $ cd /path/to/pki/root $ tox Some useful options: Remove .tox directory and start with a refresh set of virtual environments: $ tox -r Just test one specific environment: $ tox -e lint Christian
On 7/1/2015 6:59 AM, Christian Heimes wrote:
Hi,
I don't like the fact that building and testing the Python part of PKI takes so long. I have been using tox and a custom setup.py for a couple of days now. The tox tool automates source distribution, virtual envs and testing. It makes it really easy to achieve a minium level of confidence, that the Python code is correct, in a matter of seconds.
The patch is related to https://fedorahosted.org/pki/ticket/696 and https://fedorahosted.org/pki/ticket/708.
How to use tox:
$ sudo dnf install python-tox $ cd /path/to/pki/root $ tox
Some useful options:
Remove .tox directory and start with a refresh set of virtual environments:
$ tox -r
Just test one specific environment:
$ tox -e lint
Christian
The tox itself looks good, and hopefully in the future we can integrate it into the build system after addressing the "forced installation of sphinx in virtual env" on build machines as I mentioned on the IRC. I just have one more question, the patch modifies the base/common/python/conf.py which is used by python-sphinx during build. How would this change affect the build? Is this change necessary for tox to work correctly? -- Endi S. Dewata
On 2015-07-08 16:33, Endi Sukma Dewata wrote:
On 7/1/2015 6:59 AM, Christian Heimes wrote:
Hi,
I don't like the fact that building and testing the Python part of PKI takes so long. I have been using tox and a custom setup.py for a couple of days now. The tox tool automates source distribution, virtual envs and testing. It makes it really easy to achieve a minium level of confidence, that the Python code is correct, in a matter of seconds.
The patch is related to https://fedorahosted.org/pki/ticket/696 and https://fedorahosted.org/pki/ticket/708.
How to use tox:
$ sudo dnf install python-tox $ cd /path/to/pki/root $ tox
Some useful options:
Remove .tox directory and start with a refresh set of virtual environments:
$ tox -r
Just test one specific environment:
$ tox -e lint
Christian
The tox itself looks good, and hopefully in the future we can integrate it into the build system after addressing the "forced installation of sphinx in virtual env" on build machines as I mentioned on the IRC.
I just have one more question, the patch modifies the base/common/python/conf.py which is used by python-sphinx during build. How would this change affect the build? Is this change necessary for tox to work correctly?
Maybe I'm able to find a better solution for the 'forced installation of sphinx' issue. The hack is required to make sphinx pick up the correct pki package from the virtual env. If I can get sphinx to use the Python interpreter from the venv or to modify PYTHONPATH, then I don't need the hack any more. I answered your question regarding conf.py on IRC yesterday. Maybe you missed it. I commented out the configuration, because directory doesn't exist in a source checkout. The missing directory triggers a warning, which is turned into an error: $ tox -e docs GLOB sdist-make: /home/heimes/redhat/pki/setup.py docs recreate: /home/heimes/redhat/pki/.tox/docs docs installdeps: sphinx < 1.3.0 docs inst: /home/heimes/redhat/pki/.tox/dist/Dogtag PKI-10.zip docs runtests: PYTHONHASHSEED='3204000919' docs runtests: commands[0] | sphinx-build -v -W -b html -d /home/heimes/redhat/pki/.tox/docs/tmp/doctrees . /home/heimes/redhat/pki/.tox/docs/tmp/html Making output directory... ... Warning, treated as error: WARNING: html_static_path entry u'/home/heimes/redhat/pki/base/common/python/_static' does not exist ERROR: InvocationError: '/home/heimes/redhat/pki/.tox/docs/bin/sphinx-build -v -W -b html -d /home/heimes/redhat/pki/.tox/docs/tmp/doctrees . /home/heimes/redhat/pki/.tox/docs/tmp/html'
On 2015-07-08 16:33, Endi Sukma Dewata wrote:
The tox itself looks good, and hopefully in the future we can integrate it into the build system after addressing the "forced installation of sphinx in virtual env" on build machines as I mentioned on the IRC.
I just have one more question, the patch modifies the base/common/python/conf.py which is used by python-sphinx during build. How would this change affect the build? Is this change necessary for tox to work correctly?
Here is a new patch that addresses conf.py. I have also changed setup.py to include and install the upgrade scriptlets. Christian
On 7/9/2015 5:50 AM, Christian Heimes wrote:
On 2015-07-08 16:33, Endi Sukma Dewata wrote:
The tox itself looks good, and hopefully in the future we can integrate it into the build system after addressing the "forced installation of sphinx in virtual env" on build machines as I mentioned on the IRC.
I just have one more question, the patch modifies the base/common/python/conf.py which is used by python-sphinx during build. How would this change affect the build? Is this change necessary for tox to work correctly?
Here is a new patch that addresses conf.py. I have also changed setup.py to include and install the upgrade scriptlets.
Christian
Looks good to me. ACK. -- Endi S. Dewata
On 2015-07-10 04:50, Endi Sukma Dewata wrote:
On 7/9/2015 5:50 AM, Christian Heimes wrote:
On 2015-07-08 16:33, Endi Sukma Dewata wrote:
The tox itself looks good, and hopefully in the future we can integrate it into the build system after addressing the "forced installation of sphinx in virtual env" on build machines as I mentioned on the IRC.
I just have one more question, the patch modifies the base/common/python/conf.py which is used by python-sphinx during build. How would this change affect the build? Is this change necessary for tox to work correctly?
Here is a new patch that addresses conf.py. I have also changed setup.py to include and install the upgrade scriptlets.
Christian
Looks good to me. ACK.
Pushed in 597bf54f3e999867a3e42686b3063b169b52018c Christian
participants (2)
-
Christian Heimes -
Endi Sukma Dewata