-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/64970/
-----------------------------------------------------------

(Updated Jan. 18, 2018, 11:20 p.m.)


Review request for mesos, Armand Grillet and Kevin Klues.


Repository: mesos


Description (updated)
-------

Use tox for linting and testing code living uder src/python.

At the moment, all linting is done through the same `pylint` installation under 
support/.virtualenv, which requires ALL dependencies (i.e. 
pip-requirements.txt, requirements.in scattered in various directories) to be 
installed in the same virtualenv, making things really messy -- e.g. when I've 
changed some code under `src/python/lib`, but don't have the dev virtualenv 
activated, linting will fail since none of the dependencies under 
`src/python/lib` have been installed.

Using tox, we can solve this problem by distributing a "test spec" (tox.ini) in 
each of the python source directories which are aware of its local dependencies 
only. To test or lint the code there would be as simple as running `tox -e 
py27-lint <file_path>`, and the corresponding virtualenv and test dependencies 
would automatically be setup.

This patch modifies `support/mesos-style.py` to install `tox` in 
`support/.virtualenv` and delegates linting to a `tox` call when it sees python 
directories that have tox setup for it. Linting for all other languages will 
not be effected.


Diffs (updated)
-----

  src/python/cli_new/tox.ini PRE-CREATION 
  src/python/lib/requirements-test.in b2b73aab65377d9310797203ea84c5150ae60805 
  src/python/lib/tox.ini 8ad030d2dbf1fb7a04f1eaadb587462b4ef3f054 
  support/mesos-style.py 1b34ea2d9afa8f17b545841cea7a6853a6e18144 


Diff: https://reviews.apache.org/r/64970/diff/2/

Changes: https://reviews.apache.org/r/64970/diff/1-2/


Testing
-------

1. intentionally create a lint error, such as extra spaces before a parens in a 
python file
2. run the pre-commit hook and see tox in action


Thanks,

Eric Chung

Reply via email to