-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Add skip_on_exit_code to SSHOperator #36303
Conversation
1781763
to
d95e1c1
Compare
0059e4a
to
c728511
Compare
if expected_exc is None: | ||
operator.execute({}) | ||
else: | ||
with pytest.raises(expected_exc): | ||
operator.execute({}) |
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.
if expected_exc is None: | |
operator.execute({}) | |
else: | |
with pytest.raises(expected_exc): | |
operator.execute({}) | |
with pytest.raises(expected_exc): | |
operator.execute({}) |
It's a nit really, but you don't need the branch here.
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.
There are test cases with exit code 0 which does not raise exception. But passing None
or empty tuple to pytest.raises
is not supported:
ValueError: Expected an exception type or a tuple of exception types, but got None. Raising exceptions is already understood as failing the test, so you don't need any special code to say 'this should never raise an exception'.
ValueError: Expected an exception type or a tuple of exception types, but got (). Raising exceptions is already understood as failing the test, so you don't need any special code to say 'this should never raise an exception'.
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.
Nit
Now SSHOperator supports option
skip_on_exit_code
, just likeBashOperator
,PythonVirtualenvOperator
and others.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.