AVRO-2652: Use Tox to Enable Multi Python Testing#742
AVRO-2652: Use Tox to Enable Multi Python Testing#742kojiromike merged 6 commits intoapache:masterfrom
Conversation
|
I never understood why we need tox when we have Docker. I understand that we now have one single environment for everything which isn't ideal. |
|
By itself tox doesn't do much with only a single python version, and if we had a bunch of different Dockerfiles it might be a different story, but in this case, with python 2.7 and 3.5 installed in the same image, tox will be pretty useful. I am laying a groundwork here to be able to run multiple python versions against the same lang/py tests to show that we have effective python 3.5 support and can deprecate lang/py3. |
|
Another useful thing tox does is actually run the tests against the installable package, instead of testing against just a bunch of files. I found several bugs in our packaging setup just by trying to enable tox. |
Using json.dumps on a dict gives the simplest possible way to pretty-print a schema, but it doesn't give any control over the output order. But the test kit assumes the output is in a specific order, which is not guaranteed by older Python implementations. This change sorts the keys for the simplest possible stable output order.
Tox enables testing with multiple versions of python in the same place.
34d8d0e to
0ce6f23
Compare
|
The additional fix for AVRO-2657 works for me (in the build logs:) |
| mkdir -p avro/test/interop {toxinidir}/../../build/interop/data | ||
| cp -r {toxinidir}/../../build/interop/data avro/test/interop | ||
| python -m avro.test.gen_interop_data avro/interop.avsc avro/test/interop/data/py.avro | ||
| cp -r avro/test/interop/data {toxinidir}/../../build/interop |
There was a problem hiding this comment.
@sekikn @RyanSkraba I've rolled the AVRO-2657 fix into this PR, using slightly different implementations in build.sh and tox.ini. You can see here the precommand always does a best-effort to get any avro generated by other languages' interop generators into the python data path. Unlike ./build.sh interop-data-test, this approach will test with any environment that we can describe to tox (see #744). Here, the avro files don't get copied into the working copy, but only into the tox virtualenv.
Do you have any feedback on this approach?
|
@kojiromike Sorry for the late reply, and failing CI after merging this PR is my bad. Merging #705 is supposed to resolve it. |
|
That's ok. I merged the other pr. Looking forward to being green again! |
|
I saw the CI went back to green. Thanks @kojiromike! |
|
Sorry for the late reply. On the second thought, I think having tox in this case makes sense. I don't see any other pragmatic options. |
* AVRO-2652: Fix Inconsistent Pretty Output Order Using json.dumps on a dict gives the simplest possible way to pretty-print a schema, but it doesn't give any control over the output order. But the test kit assumes the output is in a specific order, which is not guaranteed by older Python implementations. This change sorts the keys for the simplest possible stable output order. * AVRO-2652: Run Tests with Tox Tox enables testing with multiple versions of python in the same place. * AVRO-2652: Tox in Docker * AVRO-2657: Fix Python Interop Data Generator * AVRO-2657: Test with Interop Data * AVRO-2657: Make build.sh do interop tests
Jira
toxas a test meta-runner. Tox has an MIT license. That license complies with the ASF 3rd Party License Policy.Tests
Commits
Documentation