On Tue, Oct 16, 2018 at 12:48 AM Udi Meiri <ehudm@xxxxxxxxxx> wrote:Hi,In light of increasing Python pre-commit times due to the added Python 3 tests,I thought it might be time to re-evaluate the tools used for Python tests and development, and propose an alternative.Currently, we use nosetests, tox, and virtualenv for testing.The proposal is to use Bazel, which I believe can replace the above tools while adding:- parallel testing: each target has its own build directory,We could look at detox and/or retox again to get parallel testing (though not, possibly, at such a low level). We tried detox for a while, but there were issues debugging timeouts (specifically, it buffered the stdout while testing to avoid multiplexing it, but that meant little info when a test actually timed out on jenkins).We could alternatively look into leveraging gradle's within-project paralleliziaton to speed this up. It is a pain that right now every Python test is run sequentially.
providing isolation from build artifacts such as from CythonEach tox environment already has (I think) its own build directory. Or is this not what we're seeing?
- incremental testing: it is possible to precisely define each test's dependenciesThis is a big plus. It would allow us to enforce non-dependence on non-dependencies as well.There's also a requirement to test against specific Python versions, such as 2.7 and 3.4.This could be done using docker containers having the precise version of interpreter and Bazel.I'm generally -1 on requiring docker to run our unittests.
In summary:Bazel could replace the need for virtualenv, tox, and nosetests.The addition of Docker images would allow testing against specific Python versions.To be clear, I really like Bazel, and would have liked to see it for our top-level build, but there were some problems that were never adequately addressed.(1) There were difficulties managing upstream dependencies correctly. Perhaps there has been some improvement upstream since we last looked at this (it was fairly new), and perhaps it's not as big a deal in Python, but this was the blocker for using it for Beam as a whole.(2) Bazel still has poor support for C (including Cython) extensions.(3) It's unclear how this would interact with setup.py. Would we keep both, using one for testing and the other for releases (sdist, wheels)?There's also the downside of introducing yet another build tool that's not familiar to the Python community, rather than sticking with the "standard" ones.I would, however, be interested in hearing others' thoughts on this proposal.
Description: S/MIME Cryptographic Signature