Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-5612] Add py3 cython tox environment #7802

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions sdks/python/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,19 @@ test.dependsOn testPython2
toxTask "testPython3", "py3"
test.dependsOn testPython3

toxTask "testCython", "py27-cython"
test.dependsOn testCython
// Ensure that testCython runs exclusively to other tests. This line is not
toxTask "testPy2Cython", "py27-cython"
test.dependsOn testPy2Cython
// Ensure that testPy2Cython runs exclusively to other tests. This line is not
// actually required, since gradle doesn't do parallel execution within a
// project.
testCython.mustRunAfter testPython2, testPy2Gcp
testPy2Cython.mustRunAfter testPython2, testPy2Gcp

toxTask "testPy3Cython", "py3-cython"
test.dependsOn testPy3Cython
// Ensure that testPy3Cython runs exclusively to other tests. This line is not
// actually required, since gradle doesn't do parallel execution within a
// project.
testPy3Cython.mustRunAfter testPython3, testPy3Gcp

toxTask "docs", "docs"
assemble.dependsOn docs
Expand All @@ -105,7 +112,8 @@ toxTask "cover", "cover"

task preCommit() {
dependsOn "docs"
dependsOn "testCython"
dependsOn "testPy2Cython"
dependsOn "testPy3Cython"
dependsOn "testPython2"
dependsOn "testPython3"
dependsOn "testPy2Gcp"
Expand Down
18 changes: 17 additions & 1 deletion sdks/python/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

[tox]
# new environments will be excluded by default unless explicitly added to envlist.
envlist = py27,py3,py27-{gcp,cython,lint,lint3},py3-{gcp,lint},docs
envlist = py27,py3,py27-{gcp,cython,lint,lint3},py3-{gcp,cython,lint},docs
toxworkdir = {toxinidir}/target/.tox

[pycodestyle]
Expand Down Expand Up @@ -78,6 +78,22 @@ commands =
python setup.py nosetests
{toxinidir}/scripts/run_tox_cleanup.sh

[testenv:py3-cython]
# cython tests are only expected to work in linux (2.x and 3.x)
# If we want to add other platforms in the future, it should be:
# `platform = linux2|darwin|...`
# See https://docs.python.org/2/library/sys.html#sys.platform for platform codes
platform = linux
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.python.org/3.5/library/sys.html#sys.platform

Changed in version 3.3: On Linux, sys.platform doesn’t contain the major version anymore. It is always 'linux', instead of 'linux2' or 'linux3'. Since older Python versions include the version number, it is recommended to always use the startswith idiom presented above

setenv =
RUN_SKIPPED_PY3_TESTS=0
commands =
python --version
pip --version
{toxinidir}/scripts/run_tox_cleanup.sh
python apache_beam/examples/complete/autocomplete_test.py
python setup.py nosetests
{toxinidir}/scripts/run_tox_cleanup.sh

[testenv:py27-gcp]
extras = test,gcp
commands =
Expand Down