From 8a138fbd0386d73bbe353a09f9d9fd6d9ab0d367 Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Thu, 6 Feb 2020 16:45:37 -0800 Subject: [PATCH] [tox] Allowing running of specific tests (#9097) --- tests/base_api_tests.py | 1 + tests/dashboard_api_tests.py | 2 ++ tests/dashboard_tests.py | 2 ++ tests/database_api_tests.py | 2 ++ tests/dataframe_test.py | 2 ++ tests/druid_func_tests.py | 2 ++ tests/log_api_tests.py | 2 ++ tests/model_tests.py | 2 ++ tests/result_set_tests.py | 2 ++ tests/security_tests.py | 2 ++ tests/sql_validator_tests.py | 2 ++ tests/sqla_models_tests.py | 2 ++ tests/sqllab_tests.py | 2 ++ tests/strategy_tests.py | 2 ++ tests/utils_tests.py | 2 ++ tests/viz_tests.py | 2 ++ tox.ini | 2 +- 17 files changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/base_api_tests.py b/tests/base_api_tests.py index 5364b53d2f..7a0481301a 100644 --- a/tests/base_api_tests.py +++ b/tests/base_api_tests.py @@ -20,6 +20,7 @@ import json from flask_appbuilder.models.sqla.interface import SQLAInterface import prison +import tests.test_app from superset import db, security_manager from superset.extensions import appbuilder from superset.models.dashboard import Dashboard diff --git a/tests/dashboard_api_tests.py b/tests/dashboard_api_tests.py index 2f72b2ea9a..af16e5fbde 100644 --- a/tests/dashboard_api_tests.py +++ b/tests/dashboard_api_tests.py @@ -14,12 +14,14 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file """Unit tests for Superset""" import json from typing import List import prison +import tests.test_app from superset import db, security_manager from superset.models import core as models from superset.models.slice import Slice diff --git a/tests/dashboard_tests.py b/tests/dashboard_tests.py index 9c03e89714..320748b115 100644 --- a/tests/dashboard_tests.py +++ b/tests/dashboard_tests.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file """Unit tests for Superset""" import json import unittest @@ -22,6 +23,7 @@ from random import random from flask import escape from sqlalchemy import func +import tests.test_app from superset import db, security_manager from superset.connectors.sqla.models import SqlaTable from superset.models import core as models diff --git a/tests/database_api_tests.py b/tests/database_api_tests.py index 7baeb6ca3e..adfc43f644 100644 --- a/tests/database_api_tests.py +++ b/tests/database_api_tests.py @@ -14,11 +14,13 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file """Unit tests for Superset""" import json import prison +import tests.test_app from superset import db from superset.models.core import Database from superset.utils.core import get_example_database diff --git a/tests/dataframe_test.py b/tests/dataframe_test.py index 71aff10478..fdb0207bba 100644 --- a/tests/dataframe_test.py +++ b/tests/dataframe_test.py @@ -14,9 +14,11 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file import numpy as np import pandas as pd +import tests.test_app from superset.dataframe import df_to_records from superset.db_engine_specs import BaseEngineSpec from superset.result_set import SupersetResultSet diff --git a/tests/druid_func_tests.py b/tests/druid_func_tests.py index c1ac6a9082..1ed7057bc7 100644 --- a/tests/druid_func_tests.py +++ b/tests/druid_func_tests.py @@ -14,10 +14,12 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file import json import unittest from unittest.mock import Mock +import tests.test_app import superset.connectors.druid.models as models from superset.connectors.druid.models import DruidColumn, DruidDatasource, DruidMetric from superset.exceptions import SupersetException diff --git a/tests/log_api_tests.py b/tests/log_api_tests.py index 86ee1732f5..dbf1084c1f 100644 --- a/tests/log_api_tests.py +++ b/tests/log_api_tests.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file """Unit tests for Superset""" import json from typing import Optional @@ -21,6 +22,7 @@ from typing import Optional import prison from flask_appbuilder.security.sqla.models import User +import tests.test_app from superset import db from superset.models.core import Log diff --git a/tests/model_tests.py b/tests/model_tests.py index 24a87b6e59..6c93ed807f 100644 --- a/tests/model_tests.py +++ b/tests/model_tests.py @@ -14,12 +14,14 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file import textwrap import unittest import pandas from sqlalchemy.engine.url import make_url +import tests.test_app from superset import app from superset.models.core import Database from superset.utils.core import get_example_database, QueryStatus diff --git a/tests/result_set_tests.py b/tests/result_set_tests.py index 6e7df13b69..1f697cc814 100644 --- a/tests/result_set_tests.py +++ b/tests/result_set_tests.py @@ -14,11 +14,13 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file from datetime import datetime import numpy as np import pandas as pd +import tests.test_app from superset.dataframe import df_to_records from superset.db_engine_specs import BaseEngineSpec from superset.result_set import dedup, SupersetResultSet diff --git a/tests/security_tests.py b/tests/security_tests.py index 8ae17ed90d..12b1f2e344 100644 --- a/tests/security_tests.py +++ b/tests/security_tests.py @@ -14,12 +14,14 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file import inspect import unittest from unittest.mock import Mock, patch import prison +import tests.test_app from superset import app, appbuilder, db, security_manager, viz from superset.connectors.druid.models import DruidCluster, DruidDatasource from superset.connectors.sqla.models import SqlaTable diff --git a/tests/sql_validator_tests.py b/tests/sql_validator_tests.py index 553e799039..4cf2956bae 100644 --- a/tests/sql_validator_tests.py +++ b/tests/sql_validator_tests.py @@ -14,12 +14,14 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file """Unit tests for Sql Lab""" import unittest from unittest.mock import MagicMock, patch from pyhive.exc import DatabaseError +import tests.test_app from superset import app from superset.sql_validators import SQLValidationAnnotation from superset.sql_validators.base import BaseSQLValidator diff --git a/tests/sqla_models_tests.py b/tests/sqla_models_tests.py index b927ce8402..e959989b33 100644 --- a/tests/sqla_models_tests.py +++ b/tests/sqla_models_tests.py @@ -14,6 +14,8 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file +import tests.test_app from superset.connectors.sqla.models import SqlaTable, TableColumn from superset.db_engine_specs.druid import DruidEngineSpec from superset.utils.core import get_example_database diff --git a/tests/sqllab_tests.py b/tests/sqllab_tests.py index be452c5587..27be7f1578 100644 --- a/tests/sqllab_tests.py +++ b/tests/sqllab_tests.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file """Unit tests for Sql Lab""" import json from datetime import datetime, timedelta @@ -21,6 +22,7 @@ from random import random import prison +import tests.test_app from superset import db, security_manager from superset.connectors.sqla.models import SqlaTable from superset.dataframe import df_to_records diff --git a/tests/strategy_tests.py b/tests/strategy_tests.py index 31a6bdfb3c..e39a2bc32d 100644 --- a/tests/strategy_tests.py +++ b/tests/strategy_tests.py @@ -14,10 +14,12 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file """Unit tests for Superset cache warmup""" import json from unittest.mock import MagicMock +import tests.test_app from superset import db from superset.models.core import Log from superset.models.tags import get_tag, ObjectTypes, TaggedObject, TagTypes diff --git a/tests/utils_tests.py b/tests/utils_tests.py index 67363ac6a4..81cc37cbd2 100644 --- a/tests/utils_tests.py +++ b/tests/utils_tests.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file import unittest import uuid from datetime import date, datetime, time, timedelta @@ -25,6 +26,7 @@ from flask import Flask from flask_caching import Cache from sqlalchemy.exc import ArgumentError +import tests.test_app from superset import app, db, security_manager from superset.exceptions import SupersetException from superset.models.core import Database diff --git a/tests/viz_tests.py b/tests/viz_tests.py index b9edb5670e..2b1752daa6 100644 --- a/tests/viz_tests.py +++ b/tests/viz_tests.py @@ -14,6 +14,7 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +# isort:skip_file import uuid from datetime import datetime from math import nan @@ -22,6 +23,7 @@ from unittest.mock import Mock, patch import numpy as np import pandas as pd +import tests.test_app import superset.viz as viz from superset import app from superset.constants import NULL_STRING diff --git a/tox.ini b/tox.ini index 8da0d30306..ad46503b53 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,7 @@ commands = {toxinidir}/superset/bin/superset db upgrade {toxinidir}/superset/bin/superset init nosetests tests/load_examples_test.py - nosetests -e load_examples_test tests {posargs} + nosetests --exclude=load_examples_test {posargs:tests} deps = -rrequirements.txt -rrequirements-dev.txt