Skip to content

Commit

Permalink
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 036165f commit 8287021
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def reset_db():
"""
Resets Airflow db.
"""
db.resetdb()
db.resetdb(rbac=True)
yield


Expand Down Expand Up @@ -91,17 +91,17 @@ def breeze_test_helper(request):
if request.config.option.db_init:
print("Initializing the DB - forced with --with-db-init switch.")
try:
db.initdb()
db.initdb(rbac=True)
except: # pylint: disable=bare-except # noqa
print("Skipping db initialization because database already exists.")
db.resetdb()
db.resetdb(rbac=True)
elif not os.path.exists(pid_file):
print(
"Initializing the DB - first time after entering the container.\n"
"You can force re-initialization the database by adding --with-db-init switch to run-tests."
)
try:
db.initdb()
db.initdb(rbac=True)
except: # pylint: disable=bare-except # noqa
print("Skipping db initialization because database already exists.")
db.resetdb(rbac=True)
Expand Down
1 change: 0 additions & 1 deletion tests/contrib/operators/test_ssh_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from airflow.models import DAG, TaskInstance
from airflow.utils import timezone
from airflow.utils.timezone import datetime
from tests.compat import mock
from tests.test_utils.config import conf_vars

TEST_DAG_ID = 'unit_tests_ssh_test_op'
Expand Down
3 changes: 2 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ def test_illegal_args(self):
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(
Expand Down Expand Up @@ -2561,7 +2562,7 @@ def get_conn(self):

class ConnectionTest(unittest.TestCase):
def setUp(self):
utils.db.initdb()
utils.db.initdb(rbac=True)
os.environ['AIRFLOW_CONN_TEST_URI'] = (
'postgres://username:[email protected]:5432/the_database')
os.environ['AIRFLOW_CONN_TEST_URI_NO_CREDS'] = (
Expand Down

0 comments on commit 8287021

Please sign in to comment.