-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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-5878] add tests for kwonly args in python 3 #8505
Conversation
R: @tvalentyn |
|
||
result3 = pcol | 'compute3' >> beam.FlatMap( | ||
sort_with_side_inputs) | ||
assert_that(result3, equal_to([]), label='assert3') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(didn't look into the logic in detail yet) is the result supposed to be empty here and in line 64?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes because it joins with the side input and in this case there is no side input
@tvalentyn The test currently fails on pylint 2.7 because the syntax of keyword only args gives a syntax-error in python 2. Should I add a pylint disable syntax-error comment or is there an other way to skip this file for python 2? |
Let's try to disable a particular pylint warning and add a comment. |
@tvalentyn Apparently |
Adding as exception sounds good to me. Is it possible to add and exception on Python 2 lint only? If that's hard, you can file a Jira and add a comment to clean this up eventually. |
a4796f6
to
7a169c2
Compare
It looks like the suite still fails on Py2 due to unsupported syntax. |
1960b43
to
403b5ed
Compare
@tvalentyn PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, this is great! Left a few minor comments.
pipeline = TestPipeline() | ||
|
||
# Keyword-only arguments are not available on Python 2 | ||
# pylint: disable=syntax-error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover comment?
result1 = pcoll | 'sum1' >> beam.ParDo(MyDoFn(), 5, 8, bound=15) | ||
result2 = pcoll | 'sum2' >> beam.ParDo(MyDoFn(), 5, 8) | ||
result3 = pcoll | 'sum3' >> beam.ParDo(MyDoFn()) | ||
result4 = pcoll | 'sum4' >> beam.ParDo(MyDoFn(), bound=10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could select a smaller bound (5) here for result4 to be different.
result1 = pcoll | 'sum1' >> beam.CombineGlobally(bounded_sum, 5, 8, bound=20) | ||
result2 = pcoll | 'sum2' >> beam.CombineGlobally(bounded_sum, 5, 8) | ||
result3 = pcoll | 'sum3' >> beam.CombineGlobally(bounded_sum) | ||
result4 = pcoll | 'sum4' >> beam.CombineGlobally(bounded_sum, bound=12) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could select a smaller bound here for result4
to be different.
sdks/python/scripts/run_pylint.sh
Outdated
@@ -60,8 +60,15 @@ EXCLUDED_GENERATED_FILES=( | |||
apache_beam/portability/api/*pb2*.py | |||
) | |||
|
|||
# Following files contain python 3 syntax and are excluded from pylint in python 2 | |||
EXCLUDED_PYTHON3_FILES=( | |||
"apache_beam/transforms/transforms_keyword_only_args_py3_test.py" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add # TODO(BEAM-7372): Remove this list once Python 2 is no longer supported and drop _py3_test suffix.
sdks/python/scripts/run_pylint.sh
Outdated
@@ -60,8 +60,15 @@ EXCLUDED_GENERATED_FILES=( | |||
apache_beam/portability/api/*pb2*.py | |||
) | |||
|
|||
# Following files contain python 3 syntax and are excluded from pylint in python 2 | |||
EXCLUDED_PYTHON3_FILES=( | |||
"apache_beam/transforms/transforms_keyword_only_args_py3_test.py" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think _py3_only_test
may be a more explicit suffix, how about we use that?
Also could this be a regex pattern .*_py3_only_test.py
?
e113e64
to
ae5da58
Compare
Run Python PreCommit |
c0c5abd
to
5f0c245
Compare
@tvalentyn PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this change beam_PostCommit_Python_Verify :sdks:python:postCommitIT and other tests are failing due to a syntax error. I filed an issue: https://issues.apache.org/jira/browse/BEAM-7481 |
This reverts commit 15d0341.
* Also add back the unit tests introduced in apache#8505 with minor changes.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.