Skip to content

Commit

Permalink
fixup! fixup! [AIRFLOW-6058] Running tests with pytest (apache#6472)
Browse files Browse the repository at this point in the history
  • Loading branch information
potiuk committed Dec 10, 2019
1 parent 8287021 commit 5b4e5b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion tests/contrib/operators/test_bigquery_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,12 @@ def test_execute(self, mock_hook):
class BigQueryOperatorTest(unittest.TestCase):
def test_bql_deprecation_warning(self):
with warnings.catch_warnings(record=True) as w:
BigQueryOperator(
task = BigQueryOperator(
task_id='test_deprecation_warning_for_bql',
bql='select * from test_table'
)
assert task, "The task should be created."
assert len(w) >= 1, "There should be at least one warning."
self.assertIn(
'Deprecated parameter `bql`',
w[0].message.args[0])
Expand Down
17 changes: 9 additions & 8 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,18 +434,19 @@ def test_illegal_args(self):
Tests that Operators reject illegal arguments
"""
with warnings.catch_warnings(record=True) as w:
BashOperator(
task = BashOperator(
task_id='test_illegal_args',
bash_command='echo success',
dag=self.dag,
illegal_argument_1234='hello?')
assert len(w) >= 1, "There should be at least one warning."
self.assertTrue(
issubclass(w[0].category, PendingDeprecationWarning))
self.assertIn(
('Invalid arguments were passed to BashOperator '
'(task_id: test_illegal_args).'),
w[0].message.args[0])
assert task, "The task should be created."
assert len(w) >= 1, "There should be at least one warning."
self.assertTrue(
issubclass(w[0].category, PendingDeprecationWarning))
self.assertIn(
('Invalid arguments were passed to BashOperator '
'(task_id: test_illegal_args).'),
w[0].message.args[0])

def test_bash_operator(self):
t = BashOperator(
Expand Down
3 changes: 3 additions & 0 deletions tests/www_rbac/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from datetime import timedelta
from urllib.parse import quote_plus

import pytest
from flask import Markup, url_for
from flask._compat import PY2
from parameterized import parameterized
Expand Down Expand Up @@ -1477,6 +1478,7 @@ def test_task_success_for_all_dag_user(self):
resp = self.client.get(url, follow_redirects=True)
self.check_content_in_response('Task Instance Details', resp)

@pytest.mark.skip(reason="This test should be run last.")
def test_xcom_success(self):
self.logout()
self.login()
Expand All @@ -1494,6 +1496,7 @@ def test_xcom_failure(self):
resp = self.client.get(url, follow_redirects=True)
self.check_content_not_in_response('XCom', resp)

@pytest.mark.skip(reason="This test should be run last.")
def test_xcom_success_for_all_dag_user(self):
self.logout()
self.login(username='all_dag_user',
Expand Down

0 comments on commit 5b4e5b2

Please sign in to comment.