From b5119b8dff78bfab4031ed80bad3e7206ff45e19 Mon Sep 17 00:00:00 2001 From: ofekisr <35701650+ofekisr@users.noreply.github.com> Date: Thu, 1 Jul 2021 18:03:07 +0300 Subject: [PATCH] refactor(tests): decouple unittests from integration tests (#15473) * refactor move all tests to be under integration_tests package * refactor decouple unittests from integration tests - commands * add unit_tests package * fix celery_tests.py * fix wrong FIXTURES_DIR value --- .github/workflows/bashlib.sh | 2 +- .github/workflows/superset-e2e.yml | 2 +- .../workflows/superset-python-presto-hive.yml | 4 +- .../workflows/superset-python-unittest.yml | 6 +-- CONTRIBUTING.md | 2 +- docker/docker-bootstrap.sh | 2 +- scripts/python_tests.sh | 2 +- scripts/tests/run.sh | 2 +- .../__init__.py | 0 tests/{ => integration_tests}/access_tests.py | 14 ++++-- tests/{ => integration_tests}/alerts_tests.py | 6 +-- .../annotation_layers}/__init__.py | 0 .../annotation_layers/api_tests.py | 6 +-- .../annotation_layers/fixtures.py | 2 +- .../async_events}/__init__.py | 0 .../async_events/api_tests.py | 4 +- .../{ => integration_tests}/base_api_tests.py | 6 ++- tests/{ => integration_tests}/base_tests.py | 2 +- tests/{ => integration_tests}/cache_tests.py | 4 +- .../cachekeys}/__init__.py | 0 .../cachekeys/api_tests.py | 4 +- tests/{ => integration_tests}/celery_tests.py | 10 +++-- .../charts}/__init__.py | 0 .../charts/api_tests.py | 41 ++++++++++++------ .../charts/commands_tests.py | 8 ++-- .../charts/schema_tests.py | 6 +-- tests/{ => integration_tests}/cli_tests.py | 4 +- .../{ => integration_tests}/commands_test.py | 2 +- tests/{ => integration_tests}/config_tests.py | 4 +- tests/{ => integration_tests}/conftest.py | 6 +-- tests/{ => integration_tests}/core_tests.py | 20 ++++++--- .../css_templates}/__init__.py | 0 .../css_templates/api_tests.py | 4 +- .../csv_upload_tests.py | 8 ++-- .../dashboard_tests.py | 20 ++++++--- .../dashboard_utils.py | 0 .../dashboards}/__init__.py | 0 .../dashboards/api_tests.py | 18 +++++--- .../dashboards/base_case.py | 12 +++-- .../dashboards/commands_tests.py | 8 ++-- .../dashboards/consts.py | 0 .../dashboards/dao_tests.py | 8 ++-- .../dashboards/dashboard_test_utils.py | 2 +- .../dashboards/security}/__init__.py | 0 .../dashboards/security/base_case.py | 2 +- .../security/security_dataset_tests.py | 12 ++--- .../security/security_rbac_tests.py | 16 ++++--- .../dashboards/superset_factory_util.py | 6 ++- .../databases}/__init__.py | 0 .../databases/api_tests.py | 24 ++++++---- .../databases/commands_tests.py | 12 +++-- .../databases/schema_tests.py | 0 .../{ => integration_tests}/dataframe_test.py | 2 +- .../datasets}/__init__.py | 0 .../datasets/api_tests.py | 14 +++--- .../datasets/commands_tests.py | 12 +++-- .../datasource_tests.py | 4 +- .../db_engine_specs}/__init__.py | 0 .../db_engine_specs/ascend_tests.py | 2 +- .../db_engine_specs/athena_tests.py | 2 +- .../db_engine_specs/base_engine_spec_tests.py | 4 +- .../db_engine_specs/base_tests.py | 4 +- .../db_engine_specs/bigquery_tests.py | 2 +- .../db_engine_specs/clickhouse_tests.py | 2 +- .../db_engine_specs/crate_tests.py | 2 +- .../db_engine_specs/dremio_tests.py | 2 +- .../db_engine_specs/drill_tests.py | 2 +- .../db_engine_specs/druid_tests.py | 6 +-- .../db_engine_specs/elasticsearch_tests.py | 2 +- .../db_engine_specs/firebird_tests.py | 0 .../db_engine_specs/gsheets_tests.py | 2 +- .../db_engine_specs/hana_tests.py | 2 +- .../db_engine_specs/hive_tests.py | 2 +- .../db_engine_specs/impala_tests.py | 2 +- .../db_engine_specs/kylin_tests.py | 2 +- .../db_engine_specs/mssql_tests.py | 2 +- .../db_engine_specs/mysql_tests.py | 5 ++- .../db_engine_specs/oracle_tests.py | 2 +- .../db_engine_specs/pinot_tests.py | 2 +- .../db_engine_specs/postgres_tests.py | 9 ++-- .../db_engine_specs/presto_tests.py | 2 +- .../db_engine_specs/redshift_tests.py | 2 +- .../db_engine_specs/snowflake_tests.py | 2 +- .../db_engine_specs/sqlite_tests.py | 2 +- .../db_engine_specs/trino_tests.py | 2 +- .../dict_import_export_tests.py | 2 +- .../druid_func_tests.py | 2 +- .../druid_func_tests_sip38.py | 2 +- tests/{ => integration_tests}/druid_tests.py | 2 +- .../dynamic_plugins_tests.py | 0 tests/{ => integration_tests}/email_tests.py | 2 +- .../event_logger_tests.py | 2 +- .../feature_flag_tests.py | 2 +- tests/integration_tests/fixtures/__init__.py | 31 +++++++++++++ .../fixtures/birth_names_dashboard.py | 4 +- .../fixtures/certificates.py | 0 .../fixtures/database.py | 0 .../fixtures/dataframes.py | 0 .../fixtures/datasource.py | 0 .../fixtures/deck_geojson_form_data.json | 0 .../fixtures/deck_path_form_data.json | 0 .../fixtures/energy_dashboard.py | 7 ++- .../fixtures/importexport.py | 0 .../fixtures/public_role.py | 2 +- .../fixtures/pyodbcRow.py | 0 .../fixtures/query_context.py | 2 +- .../fixtures/sample.png | Bin .../fixtures/trends.csv | 0 .../fixtures/unicode_dashboard.py | 4 +- .../fixtures/world_bank_dashboard.py | 7 ++- tests/{ => integration_tests}/form_tests.py | 2 +- .../import_export_tests.py | 14 ++++-- .../importexport/commands_tests.py | 2 +- .../insert_chart_mixin.py | 0 .../jinja_context_tests.py | 8 ++-- .../{ => integration_tests}/log_api_tests.py | 0 .../log_model_view_tests.py | 0 .../logging_configurator_tests.py | 0 .../migration_tests.py | 0 .../migrations/__init__.py | 0 .../migrations/f1410ed7ec95_tests.py | 0 .../migrations/fc3a3a8ff221_tests.py | 0 tests/{ => integration_tests}/model_tests.py | 6 ++- .../pandas_postprocessing_tests.py | 0 .../queries/__init__.py | 0 .../queries/api_tests.py | 4 +- .../queries/saved_queries/__init__.py | 0 .../queries/saved_queries/api_tests.py | 6 +-- .../queries/saved_queries/commands_tests.py | 4 +- .../query_context_tests.py | 8 ++-- .../reports/__init__.py | 0 .../reports/api_tests.py | 10 +++-- .../reports/commands_tests.py | 12 ++--- .../reports/scheduler_tests.py | 4 +- .../{ => integration_tests}/reports/utils.py | 0 .../result_set_tests.py | 2 +- .../{ => integration_tests}/schedules_test.py | 10 +++-- .../security/__init__.py | 0 .../security/analytics_db_safety_tests.py | 2 +- .../security/api_tests.py | 2 +- .../security/migrate_roles_tests.py | 2 +- .../{ => integration_tests}/security_tests.py | 18 +++++--- .../sql_parse_tests.py | 0 .../sql_validator_tests.py | 0 .../sqla_models_tests.py | 4 +- .../sqla_views_tests.py | 4 +- tests/{ => integration_tests}/sqllab_tests.py | 4 +- .../stats_logger_tests.py | 0 .../{ => integration_tests}/strategy_tests.py | 4 +- .../superset_test_config.py | 10 +++-- ...rset_test_config_sqllab_backend_persist.py | 0 .../superset_test_config_thumbnails.py | 4 +- ...uperset_test_custom_template_processors.py | 0 .../{ => integration_tests}/tagging_tests.py | 4 +- .../{ => integration_tests}/tasks/__init__.py | 0 .../tasks/async_queries_tests.py | 10 +++-- tests/{ => integration_tests}/test_app.py | 2 +- .../thumbnails_tests.py | 4 +- .../{ => integration_tests}/utils/__init__.py | 2 +- .../utils/core_tests.py | 0 .../utils/csv_tests.py | 0 .../utils/date_parser_tests.py | 2 +- .../utils/decorators_tests.py | 2 +- .../utils/encrypt_tests.py | 2 +- .../utils/get_dashboards.py | 0 .../utils/hashing_tests.py | 0 .../utils/machine_auth_tests.py | 2 +- .../utils/public_interfaces_test.py | 2 +- tests/{ => integration_tests}/utils_tests.py | 12 +++-- tests/{ => integration_tests}/viz_tests.py | 2 +- tests/unit_tests/__init__.py | 16 +++++++ tox.ini | 14 +++--- 172 files changed, 456 insertions(+), 262 deletions(-) rename tests/{annotation_layers => integration_tests}/__init__.py (100%) rename tests/{ => integration_tests}/access_tests.py (98%) rename tests/{ => integration_tests}/alerts_tests.py (98%) rename tests/{async_events => integration_tests/annotation_layers}/__init__.py (100%) rename tests/{ => integration_tests}/annotation_layers/api_tests.py (99%) rename tests/{ => integration_tests}/annotation_layers/fixtures.py (98%) rename tests/{cachekeys => integration_tests/async_events}/__init__.py (100%) rename tests/{ => integration_tests}/async_events/api_tests.py (97%) rename tests/{ => integration_tests}/base_api_tests.py (98%) rename tests/{ => integration_tests}/base_tests.py (99%) rename tests/{ => integration_tests}/cache_tests.py (97%) rename tests/{charts => integration_tests/cachekeys}/__init__.py (100%) rename tests/{ => integration_tests}/cachekeys/api_tests.py (98%) rename tests/{ => integration_tests}/celery_tests.py (98%) rename tests/{css_templates => integration_tests/charts}/__init__.py (100%) rename tests/{ => integration_tests}/charts/api_tests.py (98%) rename tests/{ => integration_tests}/charts/commands_tests.py (97%) rename tests/{ => integration_tests}/charts/schema_tests.py (95%) rename tests/{ => integration_tests}/cli_tests.py (98%) rename tests/{ => integration_tests}/commands_test.py (95%) rename tests/{ => integration_tests}/config_tests.py (98%) rename tests/{ => integration_tests}/conftest.py (95%) rename tests/{ => integration_tests}/core_tests.py (99%) rename tests/{dashboards => integration_tests/css_templates}/__init__.py (100%) rename tests/{ => integration_tests}/css_templates/api_tests.py (99%) rename tests/{ => integration_tests}/csv_upload_tests.py (97%) rename tests/{ => integration_tests}/dashboard_tests.py (97%) rename tests/{ => integration_tests}/dashboard_utils.py (100%) rename tests/{dashboards/security => integration_tests/dashboards}/__init__.py (100%) rename tests/{ => integration_tests}/dashboards/api_tests.py (99%) rename tests/{ => integration_tests}/dashboards/base_case.py (93%) rename tests/{ => integration_tests}/dashboards/commands_tests.py (99%) rename tests/{ => integration_tests}/dashboards/consts.py (100%) rename tests/{ => integration_tests}/dashboards/dao_tests.py (94%) rename tests/{ => integration_tests}/dashboards/dashboard_test_utils.py (97%) rename tests/{databases => integration_tests/dashboards/security}/__init__.py (100%) rename tests/{ => integration_tests}/dashboards/security/base_case.py (97%) rename tests/{ => integration_tests}/dashboards/security/security_dataset_tests.py (95%) rename tests/{ => integration_tests}/dashboards/security/security_rbac_tests.py (96%) rename tests/{ => integration_tests}/dashboards/superset_factory_util.py (98%) rename tests/{datasets => integration_tests/databases}/__init__.py (100%) rename tests/{ => integration_tests}/databases/api_tests.py (99%) rename tests/{ => integration_tests}/databases/commands_tests.py (98%) rename tests/{ => integration_tests}/databases/schema_tests.py (100%) rename tests/{ => integration_tests}/dataframe_test.py (98%) rename tests/{db_engine_specs => integration_tests/datasets}/__init__.py (100%) rename tests/{ => integration_tests}/datasets/api_tests.py (99%) rename tests/{ => integration_tests}/datasets/commands_tests.py (98%) rename tests/{ => integration_tests}/datasource_tests.py (98%) rename tests/{fixtures => integration_tests/db_engine_specs}/__init__.py (100%) rename tests/{ => integration_tests}/db_engine_specs/ascend_tests.py (93%) rename tests/{ => integration_tests}/db_engine_specs/athena_tests.py (96%) rename tests/{ => integration_tests}/db_engine_specs/base_engine_spec_tests.py (99%) rename tests/{ => integration_tests}/db_engine_specs/base_tests.py (94%) rename tests/{ => integration_tests}/db_engine_specs/bigquery_tests.py (99%) rename tests/{ => integration_tests}/db_engine_specs/clickhouse_tests.py (95%) rename tests/{ => integration_tests}/db_engine_specs/crate_tests.py (96%) rename tests/{ => integration_tests}/db_engine_specs/dremio_tests.py (94%) rename tests/{ => integration_tests}/db_engine_specs/drill_tests.py (94%) rename tests/{ => integration_tests}/db_engine_specs/druid_tests.py (92%) rename tests/{ => integration_tests}/db_engine_specs/elasticsearch_tests.py (96%) rename tests/{ => integration_tests}/db_engine_specs/firebird_tests.py (100%) rename tests/{ => integration_tests}/db_engine_specs/gsheets_tests.py (95%) rename tests/{ => integration_tests}/db_engine_specs/hana_tests.py (94%) rename tests/{ => integration_tests}/db_engine_specs/hive_tests.py (99%) rename tests/{ => integration_tests}/db_engine_specs/impala_tests.py (93%) rename tests/{ => integration_tests}/db_engine_specs/kylin_tests.py (93%) rename tests/{ => integration_tests}/db_engine_specs/mssql_tests.py (99%) rename tests/{ => integration_tests}/db_engine_specs/mysql_tests.py (98%) rename tests/{ => integration_tests}/db_engine_specs/oracle_tests.py (97%) rename tests/{ => integration_tests}/db_engine_specs/pinot_tests.py (97%) rename tests/{ => integration_tests}/db_engine_specs/postgres_tests.py (98%) rename tests/{ => integration_tests}/db_engine_specs/presto_tests.py (99%) rename tests/{ => integration_tests}/db_engine_specs/redshift_tests.py (98%) rename tests/{ => integration_tests}/db_engine_specs/snowflake_tests.py (97%) rename tests/{ => integration_tests}/db_engine_specs/sqlite_tests.py (97%) rename tests/{ => integration_tests}/db_engine_specs/trino_tests.py (96%) rename tests/{ => integration_tests}/dict_import_export_tests.py (99%) rename tests/{ => integration_tests}/druid_func_tests.py (99%) rename tests/{ => integration_tests}/druid_func_tests_sip38.py (99%) rename tests/{ => integration_tests}/druid_tests.py (99%) rename tests/{ => integration_tests}/dynamic_plugins_tests.py (100%) rename tests/{ => integration_tests}/email_tests.py (99%) rename tests/{ => integration_tests}/event_logger_tests.py (99%) rename tests/{ => integration_tests}/feature_flag_tests.py (95%) create mode 100644 tests/integration_tests/fixtures/__init__.py rename tests/{ => integration_tests}/fixtures/birth_names_dashboard.py (97%) rename tests/{ => integration_tests}/fixtures/certificates.py (100%) rename tests/{ => integration_tests}/fixtures/database.py (100%) rename tests/{ => integration_tests}/fixtures/dataframes.py (100%) rename tests/{ => integration_tests}/fixtures/datasource.py (100%) rename tests/{ => integration_tests}/fixtures/deck_geojson_form_data.json (100%) rename tests/{ => integration_tests}/fixtures/deck_path_form_data.json (100%) rename tests/{ => integration_tests}/fixtures/energy_dashboard.py (97%) rename tests/{ => integration_tests}/fixtures/importexport.py (100%) rename tests/{ => integration_tests}/fixtures/public_role.py (96%) rename tests/{ => integration_tests}/fixtures/pyodbcRow.py (100%) rename tests/{ => integration_tests}/fixtures/query_context.py (99%) rename tests/{ => integration_tests}/fixtures/sample.png (100%) rename tests/{ => integration_tests}/fixtures/trends.csv (100%) rename tests/{ => integration_tests}/fixtures/unicode_dashboard.py (97%) rename tests/{ => integration_tests}/fixtures/world_bank_dashboard.py (99%) rename tests/{ => integration_tests}/form_tests.py (96%) rename tests/{ => integration_tests}/import_export_tests.py (98%) rename tests/{ => integration_tests}/importexport/commands_tests.py (96%) rename tests/{ => integration_tests}/insert_chart_mixin.py (100%) rename tests/{ => integration_tests}/jinja_context_tests.py (98%) rename tests/{ => integration_tests}/log_api_tests.py (100%) rename tests/{ => integration_tests}/log_model_view_tests.py (100%) rename tests/{ => integration_tests}/logging_configurator_tests.py (100%) rename tests/{ => integration_tests}/migration_tests.py (100%) rename tests/{ => integration_tests}/migrations/__init__.py (100%) rename tests/{ => integration_tests}/migrations/f1410ed7ec95_tests.py (100%) rename tests/{ => integration_tests}/migrations/fc3a3a8ff221_tests.py (100%) rename tests/{ => integration_tests}/model_tests.py (99%) rename tests/{ => integration_tests}/pandas_postprocessing_tests.py (100%) rename tests/{ => integration_tests}/queries/__init__.py (100%) rename tests/{ => integration_tests}/queries/api_tests.py (99%) rename tests/{ => integration_tests}/queries/saved_queries/__init__.py (100%) rename tests/{ => integration_tests}/queries/saved_queries/api_tests.py (99%) rename tests/{ => integration_tests}/queries/saved_queries/commands_tests.py (98%) rename tests/{ => integration_tests}/query_context_tests.py (98%) rename tests/{ => integration_tests}/reports/__init__.py (100%) rename tests/{ => integration_tests}/reports/api_tests.py (99%) rename tests/{ => integration_tests}/reports/commands_tests.py (99%) rename tests/{ => integration_tests}/reports/scheduler_tests.py (96%) rename tests/{ => integration_tests}/reports/utils.py (100%) rename tests/{ => integration_tests}/result_set_tests.py (99%) rename tests/{ => integration_tests}/schedules_test.py (98%) rename tests/{ => integration_tests}/security/__init__.py (100%) rename tests/{ => integration_tests}/security/analytics_db_safety_tests.py (96%) rename tests/{ => integration_tests}/security/api_tests.py (96%) rename tests/{ => integration_tests}/security/migrate_roles_tests.py (99%) rename tests/{ => integration_tests}/security_tests.py (99%) rename tests/{ => integration_tests}/sql_parse_tests.py (100%) rename tests/{ => integration_tests}/sql_validator_tests.py (100%) rename tests/{ => integration_tests}/sqla_models_tests.py (99%) rename tests/{ => integration_tests}/sqla_views_tests.py (92%) rename tests/{ => integration_tests}/sqllab_tests.py (99%) rename tests/{ => integration_tests}/stats_logger_tests.py (100%) rename tests/{ => integration_tests}/strategy_tests.py (98%) rename tests/{ => integration_tests}/superset_test_config.py (93%) rename tests/{ => integration_tests}/superset_test_config_sqllab_backend_persist.py (100%) rename tests/{ => integration_tests}/superset_test_config_thumbnails.py (96%) rename tests/{ => integration_tests}/superset_test_custom_template_processors.py (100%) rename tests/{ => integration_tests}/tagging_tests.py (90%) rename tests/{ => integration_tests}/tasks/__init__.py (100%) rename tests/{ => integration_tests}/tasks/async_queries_tests.py (96%) rename tests/{ => integration_tests}/test_app.py (96%) rename tests/{ => integration_tests}/thumbnails_tests.py (98%) rename tests/{ => integration_tests}/utils/__init__.py (95%) rename tests/{ => integration_tests}/utils/core_tests.py (100%) rename tests/{ => integration_tests}/utils/csv_tests.py (100%) rename tests/{ => integration_tests}/utils/date_parser_tests.py (99%) rename tests/{ => integration_tests}/utils/decorators_tests.py (96%) rename tests/{ => integration_tests}/utils/encrypt_tests.py (97%) rename tests/{ => integration_tests}/utils/get_dashboards.py (100%) rename tests/{ => integration_tests}/utils/hashing_tests.py (100%) rename tests/{ => integration_tests}/utils/machine_auth_tests.py (97%) rename tests/{ => integration_tests}/utils/public_interfaces_test.py (98%) rename tests/{ => integration_tests}/utils_tests.py (99%) rename tests/{ => integration_tests}/viz_tests.py (99%) create mode 100644 tests/unit_tests/__init__.py diff --git a/.github/workflows/bashlib.sh b/.github/workflows/bashlib.sh index ff162de889..bcb3b78e73 100644 --- a/.github/workflows/bashlib.sh +++ b/.github/workflows/bashlib.sh @@ -192,7 +192,7 @@ cypress-run-all() { say "::endgroup::" # Rerun SQL Lab tests with backend persist enabled - export SUPERSET_CONFIG=tests.superset_test_config_sqllab_backend_persist + export SUPERSET_CONFIG=tests.integration_tests.superset_test_config_sqllab_backend_persist # Restart Flask with new configs kill $flaskProcessId diff --git a/.github/workflows/superset-e2e.yml b/.github/workflows/superset-e2e.yml index 13564d51c2..3b3898b520 100644 --- a/.github/workflows/superset-e2e.yml +++ b/.github/workflows/superset-e2e.yml @@ -25,7 +25,7 @@ jobs: env: FLASK_ENV: development ENABLE_REACT_CRUD_VIEWS: true - SUPERSET_CONFIG: tests.superset_test_config + SUPERSET_CONFIG: tests.integration_tests.superset_test_config SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset PYTHONPATH: ${{ github.workspace }} REDIS_PORT: 16379 diff --git a/.github/workflows/superset-python-presto-hive.yml b/.github/workflows/superset-python-presto-hive.yml index b7e05b3995..9177037822 100644 --- a/.github/workflows/superset-python-presto-hive.yml +++ b/.github/workflows/superset-python-presto-hive.yml @@ -17,7 +17,7 @@ jobs: python-version: [3.8] env: PYTHONPATH: ${{ github.workspace }} - SUPERSET_CONFIG: tests.superset_test_config + SUPERSET_CONFIG: tests.integration_tests.superset_test_config REDIS_PORT: 16379 SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset SUPERSET__SQLALCHEMY_EXAMPLES_URI: presto://localhost:15433/memory/default @@ -91,7 +91,7 @@ jobs: python-version: [3.8] env: PYTHONPATH: ${{ github.workspace }} - SUPERSET_CONFIG: tests.superset_test_config + SUPERSET_CONFIG: tests.integration_tests.superset_test_config REDIS_PORT: 16379 SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset SUPERSET__SQLALCHEMY_EXAMPLES_URI: hive://localhost:10000/default diff --git a/.github/workflows/superset-python-unittest.yml b/.github/workflows/superset-python-unittest.yml index 3a95556647..0ff0266ae1 100644 --- a/.github/workflows/superset-python-unittest.yml +++ b/.github/workflows/superset-python-unittest.yml @@ -17,7 +17,7 @@ jobs: python-version: [3.7] env: PYTHONPATH: ${{ github.workspace }} - SUPERSET_CONFIG: tests.superset_test_config + SUPERSET_CONFIG: tests.integration_tests.superset_test_config REDIS_PORT: 16379 SUPERSET__SQLALCHEMY_DATABASE_URI: | mysql+mysqldb://superset:superset@127.0.0.1:13306/superset?charset=utf8mb4&binary_prefix=true @@ -80,7 +80,7 @@ jobs: python-version: [3.7, 3.8] env: PYTHONPATH: ${{ github.workspace }} - SUPERSET_CONFIG: tests.superset_test_config + SUPERSET_CONFIG: tests.integration_tests.superset_test_config REDIS_PORT: 16379 SUPERSET__SQLALCHEMY_DATABASE_URI: postgresql+psycopg2://superset:superset@127.0.0.1:15432/superset services: @@ -144,7 +144,7 @@ jobs: python-version: [3.7] env: PYTHONPATH: ${{ github.workspace }} - SUPERSET_CONFIG: tests.superset_test_config + SUPERSET_CONFIG: tests.integration_tests.superset_test_config REDIS_PORT: 16379 SUPERSET__SQLALCHEMY_DATABASE_URI: | sqlite:///${{ github.workspace }}/.temp/unittest.db diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ccbaa1e729..619fec385b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -771,7 +771,7 @@ npm run test -- path/to/file.js We use [Cypress](https://www.cypress.io/) for integration tests. Tests can be run by `tox -e cypress`. To open Cypress and explore tests first setup and run test server: ```bash -export SUPERSET_CONFIG=tests.superset_test_config +export SUPERSET_CONFIG=tests.integration_tests.superset_test_config export SUPERSET_TESTENV=true export ENABLE_REACT_CRUD_VIEWS=true export CYPRESS_BASE_URL="http://localhost:8081" diff --git a/docker/docker-bootstrap.sh b/docker/docker-bootstrap.sh index e4468b8ad0..4a8e279664 100755 --- a/docker/docker-bootstrap.sh +++ b/docker/docker-bootstrap.sh @@ -21,7 +21,7 @@ set -eo pipefail REQUIREMENTS_LOCAL="/app/docker/requirements-local.txt" # If Cypress run – overwrite the password for admin and export env variables if [ "$CYPRESS_CONFIG" == "true" ]; then - export SUPERSET_CONFIG=tests.superset_test_config + export SUPERSET_CONFIG=tests.integration_tests.superset_test_config export SUPERSET_TESTENV=true export ENABLE_REACT_CRUD_VIEWS=true export SUPERSET__SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://superset:superset@db:5432/superset diff --git a/scripts/python_tests.sh b/scripts/python_tests.sh index d34e605a21..b9ef2cee21 100755 --- a/scripts/python_tests.sh +++ b/scripts/python_tests.sh @@ -18,7 +18,7 @@ # set -e -export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.superset_test_config} +export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.integration_tests.superset_test_config} export SUPERSET_TESTENV=true echo "Superset config module: $SUPERSET_CONFIG" diff --git a/scripts/tests/run.sh b/scripts/tests/run.sh index be1a11988e..9f78318b72 100755 --- a/scripts/tests/run.sh +++ b/scripts/tests/run.sh @@ -62,7 +62,7 @@ DB_NAME="test" DB_USER="superset" DB_PASSWORD="superset" export SUPERSET__SQLALCHEMY_DATABASE_URI=${SUPERSET__SQLALCHEMY_DATABASE_URI:-postgresql+psycopg2://"${DB_USER}":"${DB_PASSWORD}"@localhost/"${DB_NAME}"} -export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.superset_test_config} +export SUPERSET_CONFIG=${SUPERSET_CONFIG:-tests.integration_tests.superset_test_config} RUN_INIT=1 RUN_RESET_DB=1 RUN_TESTS=1 diff --git a/tests/annotation_layers/__init__.py b/tests/integration_tests/__init__.py similarity index 100% rename from tests/annotation_layers/__init__.py rename to tests/integration_tests/__init__.py diff --git a/tests/access_tests.py b/tests/integration_tests/access_tests.py similarity index 98% rename from tests/access_tests.py rename to tests/integration_tests/access_tests.py index d3cc55a1c9..3d384cb65c 100644 --- a/tests/access_tests.py +++ b/tests/integration_tests/access_tests.py @@ -19,13 +19,19 @@ import json import unittest from unittest import mock -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) import pytest -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.test_app import app # isort:skip +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.test_app import app # isort:skip from superset import db, security_manager from superset.connectors.connector_registry import ConnectorRegistry from superset.connectors.druid.models import DruidDatasource diff --git a/tests/alerts_tests.py b/tests/integration_tests/alerts_tests.py similarity index 98% rename from tests/alerts_tests.py rename to tests/integration_tests/alerts_tests.py index fec5244763..c847b71875 100644 --- a/tests/alerts_tests.py +++ b/tests/integration_tests/alerts_tests.py @@ -45,9 +45,9 @@ from superset.views.alerts import ( AlertModelView, AlertObservationModelView, ) -from tests.base_tests import SupersetTestCase -from tests.test_app import app -from tests.utils import read_fixture +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.test_app import app +from tests.integration_tests.utils import read_fixture logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) diff --git a/tests/async_events/__init__.py b/tests/integration_tests/annotation_layers/__init__.py similarity index 100% rename from tests/async_events/__init__.py rename to tests/integration_tests/annotation_layers/__init__.py diff --git a/tests/annotation_layers/api_tests.py b/tests/integration_tests/annotation_layers/api_tests.py similarity index 99% rename from tests/annotation_layers/api_tests.py rename to tests/integration_tests/annotation_layers/api_tests.py index b53624394e..292829c8cf 100644 --- a/tests/annotation_layers/api_tests.py +++ b/tests/integration_tests/annotation_layers/api_tests.py @@ -22,12 +22,12 @@ import pytest import prison from sqlalchemy.sql import func -import tests.test_app +import tests.integration_tests.test_app from superset import db from superset.models.annotations import Annotation, AnnotationLayer -from tests.base_tests import SupersetTestCase -from tests.annotation_layers.fixtures import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.annotation_layers.fixtures import ( create_annotation_layers, get_end_dttm, get_start_dttm, diff --git a/tests/annotation_layers/fixtures.py b/tests/integration_tests/annotation_layers/fixtures.py similarity index 98% rename from tests/annotation_layers/fixtures.py rename to tests/integration_tests/annotation_layers/fixtures.py index d2960acad5..cb7647d30c 100644 --- a/tests/annotation_layers/fixtures.py +++ b/tests/integration_tests/annotation_layers/fixtures.py @@ -22,7 +22,7 @@ from typing import Optional from superset import db from superset.models.annotations import Annotation, AnnotationLayer -from tests.test_app import app +from tests.integration_tests.test_app import app ANNOTATION_LAYERS_COUNT = 10 diff --git a/tests/cachekeys/__init__.py b/tests/integration_tests/async_events/__init__.py similarity index 100% rename from tests/cachekeys/__init__.py rename to tests/integration_tests/async_events/__init__.py diff --git a/tests/async_events/api_tests.py b/tests/integration_tests/async_events/api_tests.py similarity index 97% rename from tests/async_events/api_tests.py rename to tests/integration_tests/async_events/api_tests.py index 04d838b97b..a63f540dd0 100644 --- a/tests/async_events/api_tests.py +++ b/tests/integration_tests/async_events/api_tests.py @@ -19,8 +19,8 @@ from typing import Optional from unittest import mock from superset.extensions import async_query_manager -from tests.base_tests import SupersetTestCase -from tests.test_app import app +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.test_app import app class TestAsyncEventApi(SupersetTestCase): diff --git a/tests/base_api_tests.py b/tests/integration_tests/base_api_tests.py similarity index 98% rename from tests/base_api_tests.py rename to tests/integration_tests/base_api_tests.py index 76084ecbc2..e6e795f4d6 100644 --- a/tests/base_api_tests.py +++ b/tests/integration_tests/base_api_tests.py @@ -16,13 +16,15 @@ # under the License. # isort:skip_file import json -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) import pytest from flask_appbuilder.models.sqla.interface import SQLAInterface import prison -import tests.test_app +import tests.integration_tests.test_app from superset import db, security_manager from superset.extensions import appbuilder from superset.models.dashboard import Dashboard diff --git a/tests/base_tests.py b/tests/integration_tests/base_tests.py similarity index 99% rename from tests/base_tests.py rename to tests/integration_tests/base_tests.py index 14883929b1..672b8d210a 100644 --- a/tests/base_tests.py +++ b/tests/integration_tests/base_tests.py @@ -32,7 +32,7 @@ from sqlalchemy.ext.declarative.api import DeclarativeMeta from sqlalchemy.orm import Session from sqlalchemy.sql import func -from tests.test_app import app +from tests.integration_tests.test_app import app from superset.sql_parse import CtasMethod from superset import db, security_manager from superset.connectors.base.models import BaseDatasource diff --git a/tests/cache_tests.py b/tests/integration_tests/cache_tests.py similarity index 97% rename from tests/cache_tests.py rename to tests/integration_tests/cache_tests.py index 43a4cf6f3f..9f0e6d9b29 100644 --- a/tests/cache_tests.py +++ b/tests/integration_tests/cache_tests.py @@ -22,7 +22,9 @@ import pytest from superset import app, db from superset.extensions import cache_manager from superset.utils.core import QueryStatus -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) from .base_tests import SupersetTestCase diff --git a/tests/charts/__init__.py b/tests/integration_tests/cachekeys/__init__.py similarity index 100% rename from tests/charts/__init__.py rename to tests/integration_tests/cachekeys/__init__.py diff --git a/tests/cachekeys/api_tests.py b/tests/integration_tests/cachekeys/api_tests.py similarity index 98% rename from tests/cachekeys/api_tests.py rename to tests/integration_tests/cachekeys/api_tests.py index 3f08750d86..2ed4b7ef1e 100644 --- a/tests/cachekeys/api_tests.py +++ b/tests/integration_tests/cachekeys/api_tests.py @@ -18,11 +18,11 @@ """Unit tests for Superset""" from typing import Dict, Any -from tests.test_app import app # noqa +from tests.integration_tests.test_app import app # noqa from superset.extensions import cache_manager, db from superset.models.cache import CacheKey -from tests.base_tests import ( +from tests.integration_tests.base_tests import ( SupersetTestCase, post_assert_metric, test_client, diff --git a/tests/celery_tests.py b/tests/integration_tests/celery_tests.py similarity index 98% rename from tests/celery_tests.py rename to tests/integration_tests/celery_tests.py index a57517231b..e645ef78a2 100644 --- a/tests/celery_tests.py +++ b/tests/integration_tests/celery_tests.py @@ -23,16 +23,18 @@ import string import time import unittest.mock as mock from typing import Optional -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) import pytest import flask from flask import current_app -from tests.base_tests import login -from tests.conftest import CTAS_SCHEMA_NAME -from tests.test_app import app +from tests.integration_tests.base_tests import login +from tests.integration_tests.conftest import CTAS_SCHEMA_NAME +from tests.integration_tests.test_app import app from superset import db, sql_lab from superset.result_set import SupersetResultSet from superset.db_engine_specs.base import BaseEngineSpec diff --git a/tests/css_templates/__init__.py b/tests/integration_tests/charts/__init__.py similarity index 100% rename from tests/css_templates/__init__.py rename to tests/integration_tests/charts/__init__.py diff --git a/tests/charts/api_tests.py b/tests/integration_tests/charts/api_tests.py similarity index 98% rename from tests/charts/api_tests.py rename to tests/integration_tests/charts/api_tests.py index 322e0708b5..fa5c2b4527 100644 --- a/tests/charts/api_tests.py +++ b/tests/integration_tests/charts/api_tests.py @@ -23,10 +23,12 @@ from typing import Optional from unittest import mock from zipfile import is_zipfile, ZipFile -from tests.conftest import with_feature_flags +from tests.integration_tests.conftest import with_feature_flags from superset.models.sql_lab import Query -from tests.insert_chart_mixin import InsertChartMixin -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.insert_chart_mixin import InsertChartMixin +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) import humanize import prison @@ -35,8 +37,10 @@ import yaml from sqlalchemy import and_, or_ from sqlalchemy.sql import func -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices -from tests.test_app import app +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) +from tests.integration_tests.test_app import app from superset.charts.commands.data import ChartDataCommand from superset.connectors.sqla.models import SqlaTable, TableColumn from superset.errors import SupersetErrorType @@ -55,21 +59,32 @@ from superset.utils.core import ( ) -from tests.base_api_tests import ApiOwnersTestCaseMixin -from tests.base_tests import SupersetTestCase, post_assert_metric, test_client +from tests.integration_tests.base_api_tests import ApiOwnersTestCaseMixin +from tests.integration_tests.base_tests import ( + SupersetTestCase, + post_assert_metric, + test_client, +) -from tests.fixtures.importexport import ( +from tests.integration_tests.fixtures.importexport import ( chart_config, chart_metadata_config, database_config, dataset_config, dataset_metadata_config, ) -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.query_context import get_query_context, ANNOTATION_LAYERS -from tests.fixtures.unicode_dashboard import load_unicode_dashboard_with_slice -from tests.annotation_layers.fixtures import create_annotation_layers -from tests.utils.get_dashboards import get_dashboards_ids +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.query_context import ( + get_query_context, + ANNOTATION_LAYERS, +) +from tests.integration_tests.fixtures.unicode_dashboard import ( + load_unicode_dashboard_with_slice, +) +from tests.integration_tests.annotation_layers.fixtures import create_annotation_layers +from tests.integration_tests.utils.get_dashboards import get_dashboards_ids CHART_DATA_URI = "api/v1/chart/data" CHARTS_FIXTURE_COUNT = 10 diff --git a/tests/charts/commands_tests.py b/tests/integration_tests/charts/commands_tests.py similarity index 97% rename from tests/charts/commands_tests.py rename to tests/integration_tests/charts/commands_tests.py index 5ad53bfc51..4b6ef3070b 100644 --- a/tests/charts/commands_tests.py +++ b/tests/integration_tests/charts/commands_tests.py @@ -31,9 +31,11 @@ from superset.commands.importers.exceptions import IncorrectVersionError from superset.connectors.sqla.models import SqlaTable from superset.models.core import Database from superset.models.slice import Slice -from tests.base_tests import SupersetTestCase -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.importexport import ( chart_config, chart_metadata_config, database_config, diff --git a/tests/charts/schema_tests.py b/tests/integration_tests/charts/schema_tests.py similarity index 95% rename from tests/charts/schema_tests.py rename to tests/integration_tests/charts/schema_tests.py index dc191904e8..e34b7d71fb 100644 --- a/tests/charts/schema_tests.py +++ b/tests/integration_tests/charts/schema_tests.py @@ -19,11 +19,11 @@ from typing import Any, Dict, Tuple from marshmallow import ValidationError -from tests.test_app import app +from tests.integration_tests.test_app import app from superset.charts.schemas import ChartDataQueryContextSchema from superset.common.query_context import QueryContext -from tests.base_tests import SupersetTestCase -from tests.fixtures.query_context import get_query_context +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.query_context import get_query_context class TestSchema(SupersetTestCase): diff --git a/tests/cli_tests.py b/tests/integration_tests/cli_tests.py similarity index 98% rename from tests/cli_tests.py rename to tests/integration_tests/cli_tests.py index 7ea4b9350b..4ea464d562 100644 --- a/tests/cli_tests.py +++ b/tests/integration_tests/cli_tests.py @@ -27,7 +27,9 @@ from freezegun import freeze_time import superset.cli from superset import app -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) @pytest.mark.usefixtures("load_birth_names_dashboard_with_slices") diff --git a/tests/commands_test.py b/tests/integration_tests/commands_test.py similarity index 95% rename from tests/commands_test.py rename to tests/integration_tests/commands_test.py index 08c8d7ae4a..bd4206d655 100644 --- a/tests/commands_test.py +++ b/tests/integration_tests/commands_test.py @@ -18,7 +18,7 @@ from superset.commands.exceptions import CommandInvalidError from superset.commands.importers.v1.utils import is_valid_config -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class TestCommandsExceptions(SupersetTestCase): diff --git a/tests/config_tests.py b/tests/integration_tests/config_tests.py similarity index 98% rename from tests/config_tests.py rename to tests/integration_tests/config_tests.py index 1076e35c3f..6ac76793ca 100644 --- a/tests/config_tests.py +++ b/tests/integration_tests/config_tests.py @@ -19,8 +19,8 @@ import unittest from typing import Any, Dict -from tests.base_tests import SupersetTestCase -from tests.test_app import app +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.test_app import app from superset import db from superset.connectors.sqla.models import SqlaTable diff --git a/tests/conftest.py b/tests/integration_tests/conftest.py similarity index 95% rename from tests/conftest.py rename to tests/integration_tests/conftest.py index 613aaca8d3..ca10a31a69 100644 --- a/tests/conftest.py +++ b/tests/integration_tests/conftest.py @@ -22,7 +22,7 @@ import pytest from sqlalchemy.engine import Engine from unittest.mock import patch -from tests.test_app import app +from tests.integration_tests.test_app import app from superset import db from superset.extensions import feature_flag_manager from superset.utils.core import get_example_database, json_dumps_w_dates @@ -41,7 +41,7 @@ def app_context(): @pytest.fixture(autouse=True, scope="session") def setup_sample_data() -> Any: # TODO(john-bodley): Determine a cleaner way of setting up the sample data without - # relying on `tests.test_app.app` leveraging an `app` fixture which is purposely + # relying on `tests.integration_tests.test_app.app` leveraging an `app` fixture which is purposely # scoped to the function level to ensure tests remain idempotent. with app.app_context(): setup_presto_if_needed() @@ -115,7 +115,7 @@ def setup_presto_if_needed(): def with_feature_flags(**mock_feature_flags): """ - Use this decorator to mock feature flags in tests. + Use this decorator to mock feature flags in tests.integration_tests. Usage: diff --git a/tests/core_tests.py b/tests/integration_tests/core_tests.py similarity index 99% rename from tests/core_tests.py rename to tests/integration_tests/core_tests.py index db1c224b2b..c609e6ba38 100644 --- a/tests/core_tests.py +++ b/tests/integration_tests/core_tests.py @@ -25,7 +25,9 @@ import json import logging from typing import Dict, List from urllib.parse import quote -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) import pytest import pytz @@ -39,9 +41,11 @@ import sqlalchemy as sqla from sqlalchemy.exc import SQLAlchemyError from superset.models.cache import CacheKey from superset.utils.core import get_example_database -from tests.conftest import with_feature_flags -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.test_app import app +from tests.integration_tests.conftest import with_feature_flags +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.test_app import app import superset.views.utils from superset import ( dataframe, @@ -66,7 +70,9 @@ from superset.views import core as views from superset.views.database.views import DatabaseView from .base_tests import SupersetTestCase -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) logger = logging.getLogger(__name__) @@ -742,7 +748,9 @@ class TestCore(SupersetTestCase): data = self.run_sql(sql, "fdaklj3ws") self.assertEqual(data["data"][0]["test"], "2") - @mock.patch("tests.superset_test_custom_template_processors.datetime") + @mock.patch( + "tests.integration_tests.superset_test_custom_template_processors.datetime" + ) @mock.patch("superset.sql_lab.get_sql_results") def test_custom_templated_sql_json(self, sql_lab_mock, mock_dt) -> None: """Test sqllab receives macros expanded query.""" diff --git a/tests/dashboards/__init__.py b/tests/integration_tests/css_templates/__init__.py similarity index 100% rename from tests/dashboards/__init__.py rename to tests/integration_tests/css_templates/__init__.py diff --git a/tests/css_templates/api_tests.py b/tests/integration_tests/css_templates/api_tests.py similarity index 99% rename from tests/css_templates/api_tests.py rename to tests/integration_tests/css_templates/api_tests.py index f4e1f65f85..840149481d 100644 --- a/tests/css_templates/api_tests.py +++ b/tests/integration_tests/css_templates/api_tests.py @@ -21,12 +21,12 @@ import pytest import prison from sqlalchemy.sql import func -import tests.test_app +import tests.integration_tests.test_app from superset import db from superset.models.core import CssTemplate from superset.utils.core import get_example_database -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase CSS_TEMPLATES_FIXTURE_COUNT = 5 diff --git a/tests/csv_upload_tests.py b/tests/integration_tests/csv_upload_tests.py similarity index 97% rename from tests/csv_upload_tests.py rename to tests/integration_tests/csv_upload_tests.py index c12ff44343..99afbeb5c8 100644 --- a/tests/csv_upload_tests.py +++ b/tests/integration_tests/csv_upload_tests.py @@ -27,12 +27,12 @@ import pandas as pd import pytest from superset.sql_parse import Table -from tests.conftest import ADMIN_SCHEMA_NAME -from tests.test_app import app # isort:skip +from tests.integration_tests.conftest import ADMIN_SCHEMA_NAME +from tests.integration_tests.test_app import app # isort:skip from superset import db from superset.models.core import Database from superset.utils import core as utils -from tests.base_tests import get_resp, login, SupersetTestCase +from tests.integration_tests.base_tests import get_resp, login, SupersetTestCase logger = logging.getLogger(__name__) @@ -136,7 +136,7 @@ def upload_excel( def mock_upload_to_s3(filename: str, upload_prefix: str, table: Table) -> str: """ - HDFS is used instead of S3 for the unit tests. + HDFS is used instead of S3 for the unit tests.integration_tests. :param filename: The file to upload :param upload_prefix: The S3 prefix diff --git a/tests/dashboard_tests.py b/tests/integration_tests/dashboard_tests.py similarity index 97% rename from tests/dashboard_tests.py rename to tests/integration_tests/dashboard_tests.py index b15e4b1306..feac2c6070 100644 --- a/tests/dashboard_tests.py +++ b/tests/integration_tests/dashboard_tests.py @@ -25,17 +25,25 @@ import pytest from flask import escape, url_for from sqlalchemy import func -from tests.test_app import app +from tests.integration_tests.test_app import app from superset import db, security_manager from superset.connectors.sqla.models import SqlaTable from superset.models import core as models from superset.models.dashboard import Dashboard from superset.models.slice import Slice -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.public_role import public_role_like_gamma -from tests.fixtures.unicode_dashboard import load_unicode_dashboard_with_position -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.public_role import public_role_like_gamma +from tests.integration_tests.fixtures.unicode_dashboard import ( + load_unicode_dashboard_with_position, +) +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) from .base_tests import SupersetTestCase diff --git a/tests/dashboard_utils.py b/tests/integration_tests/dashboard_utils.py similarity index 100% rename from tests/dashboard_utils.py rename to tests/integration_tests/dashboard_utils.py diff --git a/tests/dashboards/security/__init__.py b/tests/integration_tests/dashboards/__init__.py similarity index 100% rename from tests/dashboards/security/__init__.py rename to tests/integration_tests/dashboards/__init__.py diff --git a/tests/dashboards/api_tests.py b/tests/integration_tests/dashboards/api_tests.py similarity index 99% rename from tests/dashboards/api_tests.py rename to tests/integration_tests/dashboards/api_tests.py index f6becf56e6..8bd1ca1b0f 100644 --- a/tests/dashboards/api_tests.py +++ b/tests/integration_tests/dashboards/api_tests.py @@ -23,7 +23,7 @@ from typing import List, Optional from unittest.mock import patch from zipfile import is_zipfile, ZipFile -from tests.insert_chart_mixin import InsertChartMixin +from tests.integration_tests.insert_chart_mixin import InsertChartMixin import pytest import prison @@ -40,9 +40,9 @@ from superset.models.slice import Slice from superset.utils.core import backend from superset.views.base import generate_download_headers -from tests.base_api_tests import ApiOwnersTestCaseMixin -from tests.base_tests import SupersetTestCase -from tests.fixtures.importexport import ( +from tests.integration_tests.base_api_tests import ApiOwnersTestCaseMixin +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.importexport import ( chart_config, database_config, dashboard_config, @@ -51,9 +51,13 @@ from tests.fixtures.importexport import ( dataset_config, dataset_metadata_config, ) -from tests.utils.get_dashboards import get_dashboards_ids -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.utils.get_dashboards import get_dashboards_ids +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) DASHBOARDS_FIXTURE_COUNT = 10 diff --git a/tests/dashboards/base_case.py b/tests/integration_tests/dashboards/base_case.py similarity index 93% rename from tests/dashboards/base_case.py rename to tests/integration_tests/dashboards/base_case.py index 42cd87bfd9..a0a1ff630f 100644 --- a/tests/dashboards/base_case.py +++ b/tests/integration_tests/dashboards/base_case.py @@ -21,10 +21,14 @@ import prison from flask import Response from superset import app, security_manager -from tests.base_tests import SupersetTestCase -from tests.dashboards.consts import * -from tests.dashboards.dashboard_test_utils import build_save_dash_parts -from tests.dashboards.superset_factory_util import delete_all_inserted_objects +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.dashboards.consts import * +from tests.integration_tests.dashboards.dashboard_test_utils import ( + build_save_dash_parts, +) +from tests.integration_tests.dashboards.superset_factory_util import ( + delete_all_inserted_objects, +) class DashboardTestCase(SupersetTestCase): diff --git a/tests/dashboards/commands_tests.py b/tests/integration_tests/dashboards/commands_tests.py similarity index 99% rename from tests/dashboards/commands_tests.py rename to tests/integration_tests/dashboards/commands_tests.py index 3449c001d9..7e466b8fcd 100644 --- a/tests/dashboards/commands_tests.py +++ b/tests/integration_tests/dashboards/commands_tests.py @@ -38,8 +38,8 @@ from superset.dashboards.commands.importers import v0, v1 from superset.models.core import Database from superset.models.dashboard import Dashboard from superset.models.slice import Slice -from tests.base_tests import SupersetTestCase -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.importexport import ( chart_config, dashboard_config, dashboard_export, @@ -48,7 +48,9 @@ from tests.fixtures.importexport import ( dataset_config, dataset_metadata_config, ) -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) class TestExportDashboardsCommand(SupersetTestCase): diff --git a/tests/dashboards/consts.py b/tests/integration_tests/dashboards/consts.py similarity index 100% rename from tests/dashboards/consts.py rename to tests/integration_tests/dashboards/consts.py diff --git a/tests/dashboards/dao_tests.py b/tests/integration_tests/dashboards/dao_tests.py similarity index 94% rename from tests/dashboards/dao_tests.py rename to tests/integration_tests/dashboards/dao_tests.py index d8e5a73536..6f6708a13d 100644 --- a/tests/dashboards/dao_tests.py +++ b/tests/integration_tests/dashboards/dao_tests.py @@ -21,12 +21,14 @@ import time import pytest -import tests.test_app # pylint: disable=unused-import +import tests.integration_tests.test_app # pylint: disable=unused-import from superset import db from superset.dashboards.dao import DashboardDAO from superset.models.dashboard import Dashboard -from tests.base_tests import SupersetTestCase -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) class TestDashboardDAO(SupersetTestCase): diff --git a/tests/dashboards/dashboard_test_utils.py b/tests/integration_tests/dashboards/dashboard_test_utils.py similarity index 97% rename from tests/dashboards/dashboard_test_utils.py rename to tests/integration_tests/dashboards/dashboard_test_utils.py index c7032f87e6..df2687fba9 100644 --- a/tests/dashboards/dashboard_test_utils.py +++ b/tests/integration_tests/dashboards/dashboard_test_utils.py @@ -25,7 +25,7 @@ from superset import appbuilder, db, security_manager from superset.connectors.sqla.models import SqlaTable from superset.models.dashboard import Dashboard from superset.models.slice import Slice -from tests.dashboards.consts import DEFAULT_DASHBOARD_SLUG_TO_TEST +from tests.integration_tests.dashboards.consts import DEFAULT_DASHBOARD_SLUG_TO_TEST logger = logging.getLogger(__name__) diff --git a/tests/databases/__init__.py b/tests/integration_tests/dashboards/security/__init__.py similarity index 100% rename from tests/databases/__init__.py rename to tests/integration_tests/dashboards/security/__init__.py diff --git a/tests/dashboards/security/base_case.py b/tests/integration_tests/dashboards/security/base_case.py similarity index 97% rename from tests/dashboards/security/base_case.py rename to tests/integration_tests/dashboards/security/base_case.py index 5c8e82151d..75e8772b59 100644 --- a/tests/dashboards/security/base_case.py +++ b/tests/integration_tests/dashboards/security/base_case.py @@ -19,7 +19,7 @@ from typing import List, Optional from flask import escape, Response from superset.models.dashboard import Dashboard -from tests.dashboards.base_case import DashboardTestCase +from tests.integration_tests.dashboards.base_case import DashboardTestCase class BaseTestDashboardSecurity(DashboardTestCase): diff --git a/tests/dashboards/security/security_dataset_tests.py b/tests/integration_tests/dashboards/security/security_dataset_tests.py similarity index 95% rename from tests/dashboards/security/security_dataset_tests.py rename to tests/integration_tests/dashboards/security/security_dataset_tests.py index b22e1fee14..de5a14ef37 100644 --- a/tests/dashboards/security/security_dataset_tests.py +++ b/tests/integration_tests/dashboards/security/security_dataset_tests.py @@ -23,11 +23,13 @@ from flask import escape from superset import app from superset.models import core as models -from tests.dashboards.base_case import DashboardTestCase -from tests.dashboards.consts import * -from tests.dashboards.dashboard_test_utils import * -from tests.dashboards.superset_factory_util import * -from tests.fixtures.energy_dashboard import load_energy_table_with_slice +from tests.integration_tests.dashboards.base_case import DashboardTestCase +from tests.integration_tests.dashboards.consts import * +from tests.integration_tests.dashboards.dashboard_test_utils import * +from tests.integration_tests.dashboards.superset_factory_util import * +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) class TestDashboardDatasetSecurity(DashboardTestCase): diff --git a/tests/dashboards/security/security_rbac_tests.py b/tests/integration_tests/dashboards/security/security_rbac_tests.py similarity index 96% rename from tests/dashboards/security/security_rbac_tests.py rename to tests/integration_tests/dashboards/security/security_rbac_tests.py index bb8666845f..c1be5a911a 100644 --- a/tests/dashboards/security/security_rbac_tests.py +++ b/tests/integration_tests/dashboards/security/security_rbac_tests.py @@ -19,17 +19,21 @@ from unittest import mock import pytest -from tests.dashboards.dashboard_test_utils import * -from tests.dashboards.security.base_case import BaseTestDashboardSecurity -from tests.dashboards.superset_factory_util import ( +from tests.integration_tests.dashboards.dashboard_test_utils import * +from tests.integration_tests.dashboards.security.base_case import ( + BaseTestDashboardSecurity, +) +from tests.integration_tests.dashboards.superset_factory_util import ( create_dashboard_to_db, create_database_to_db, create_datasource_table_to_db, create_slice_to_db, ) -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.public_role import public_role_like_gamma -from tests.fixtures.query_context import get_query_context +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.public_role import public_role_like_gamma +from tests.integration_tests.fixtures.query_context import get_query_context CHART_DATA_URI = "api/v1/chart/data" diff --git a/tests/dashboards/superset_factory_util.py b/tests/integration_tests/dashboards/superset_factory_util.py similarity index 98% rename from tests/dashboards/superset_factory_util.py rename to tests/integration_tests/dashboards/superset_factory_util.py index f62f4ac2cd..dfd2f67441 100644 --- a/tests/dashboards/superset_factory_util.py +++ b/tests/integration_tests/dashboards/superset_factory_util.py @@ -30,7 +30,11 @@ from superset.models.dashboard import ( DashboardRoles, ) from superset.models.slice import Slice, slice_user -from tests.dashboards.dashboard_test_utils import random_slug, random_str, random_title +from tests.integration_tests.dashboards.dashboard_test_utils import ( + random_slug, + random_str, + random_title, +) logger = logging.getLogger(__name__) diff --git a/tests/datasets/__init__.py b/tests/integration_tests/databases/__init__.py similarity index 100% rename from tests/datasets/__init__.py rename to tests/integration_tests/databases/__init__.py diff --git a/tests/databases/api_tests.py b/tests/integration_tests/databases/api_tests.py similarity index 99% rename from tests/databases/api_tests.py rename to tests/integration_tests/databases/api_tests.py index a637ee979f..035cb9a812 100644 --- a/tests/databases/api_tests.py +++ b/tests/integration_tests/databases/api_tests.py @@ -43,19 +43,27 @@ from superset.errors import SupersetError from superset.models.core import Database, ConfigurationMethod from superset.models.reports import ReportSchedule, ReportScheduleType from superset.utils.core import get_example_database, get_main_database -from tests.base_tests import SupersetTestCase -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.certificates import ssl_certificate -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.certificates import ssl_certificate +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) +from tests.integration_tests.fixtures.importexport import ( database_config, dataset_config, database_metadata_config, dataset_metadata_config, ) -from tests.fixtures.unicode_dashboard import load_unicode_dashboard_with_position -from tests.test_app import app +from tests.integration_tests.fixtures.unicode_dashboard import ( + load_unicode_dashboard_with_position, +) +from tests.integration_tests.test_app import app class TestDatabaseApi(SupersetTestCase): diff --git a/tests/databases/commands_tests.py b/tests/integration_tests/databases/commands_tests.py similarity index 98% rename from tests/databases/commands_tests.py rename to tests/integration_tests/databases/commands_tests.py index 92152173eb..0fe6d6bc84 100644 --- a/tests/databases/commands_tests.py +++ b/tests/integration_tests/databases/commands_tests.py @@ -42,10 +42,14 @@ from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.exceptions import SupersetErrorsException, SupersetSecurityException from superset.models.core import Database from superset.utils.core import backend, get_example_database -from tests.base_tests import SupersetTestCase -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.importexport import ( database_config, database_metadata_config, dataset_config, diff --git a/tests/databases/schema_tests.py b/tests/integration_tests/databases/schema_tests.py similarity index 100% rename from tests/databases/schema_tests.py rename to tests/integration_tests/databases/schema_tests.py diff --git a/tests/dataframe_test.py b/tests/integration_tests/dataframe_test.py similarity index 98% rename from tests/dataframe_test.py rename to tests/integration_tests/dataframe_test.py index a6dbbac301..6d747edd73 100644 --- a/tests/dataframe_test.py +++ b/tests/integration_tests/dataframe_test.py @@ -18,7 +18,7 @@ import numpy as np import pandas as pd -import tests.test_app +import tests.integration_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/db_engine_specs/__init__.py b/tests/integration_tests/datasets/__init__.py similarity index 100% rename from tests/db_engine_specs/__init__.py rename to tests/integration_tests/datasets/__init__.py diff --git a/tests/datasets/api_tests.py b/tests/integration_tests/datasets/api_tests.py similarity index 99% rename from tests/datasets/api_tests.py rename to tests/integration_tests/datasets/api_tests.py index 8d68d1c145..894c6f6900 100644 --- a/tests/datasets/api_tests.py +++ b/tests/integration_tests/datasets/api_tests.py @@ -38,11 +38,15 @@ from superset.extensions import db, security_manager from superset.models.core import Database from superset.utils.core import backend, get_example_database, get_main_database from superset.utils.dict_import_export import export_to_dict -from tests.base_tests import SupersetTestCase -from tests.conftest import CTAS_SCHEMA_NAME -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.conftest import CTAS_SCHEMA_NAME +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.importexport import ( database_config, database_metadata_config, dataset_config, diff --git a/tests/datasets/commands_tests.py b/tests/integration_tests/datasets/commands_tests.py similarity index 98% rename from tests/datasets/commands_tests.py rename to tests/integration_tests/datasets/commands_tests.py index 1293a301ff..62e8414f79 100644 --- a/tests/datasets/commands_tests.py +++ b/tests/integration_tests/datasets/commands_tests.py @@ -33,9 +33,11 @@ from superset.datasets.commands.export import ExportDatasetsCommand from superset.datasets.commands.importers import v0, v1 from superset.models.core import Database from superset.utils.core import get_example_database -from tests.base_tests import SupersetTestCase -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.importexport import ( database_config, database_metadata_config, dataset_cli_export, @@ -43,7 +45,9 @@ from tests.fixtures.importexport import ( dataset_metadata_config, dataset_ui_export, ) -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) class TestExportDatasetsCommand(SupersetTestCase): diff --git a/tests/datasource_tests.py b/tests/integration_tests/datasource_tests.py similarity index 98% rename from tests/datasource_tests.py rename to tests/integration_tests/datasource_tests.py index 4ae3957f77..14280264ac 100644 --- a/tests/datasource_tests.py +++ b/tests/integration_tests/datasource_tests.py @@ -26,7 +26,9 @@ from superset.connectors.sqla.models import SqlaTable from superset.datasets.commands.exceptions import DatasetNotFoundError from superset.exceptions import SupersetException, SupersetGenericDBErrorException from superset.utils.core import get_example_database -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) from .base_tests import db_insert_temp_object, SupersetTestCase from .fixtures.datasource import datasource_post diff --git a/tests/fixtures/__init__.py b/tests/integration_tests/db_engine_specs/__init__.py similarity index 100% rename from tests/fixtures/__init__.py rename to tests/integration_tests/db_engine_specs/__init__.py diff --git a/tests/db_engine_specs/ascend_tests.py b/tests/integration_tests/db_engine_specs/ascend_tests.py similarity index 93% rename from tests/db_engine_specs/ascend_tests.py rename to tests/integration_tests/db_engine_specs/ascend_tests.py index edbfb4c5d3..ff12656743 100644 --- a/tests/db_engine_specs/ascend_tests.py +++ b/tests/integration_tests/db_engine_specs/ascend_tests.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. from superset.db_engine_specs.ascend import AscendEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestAscendDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/athena_tests.py b/tests/integration_tests/db_engine_specs/athena_tests.py similarity index 96% rename from tests/db_engine_specs/athena_tests.py rename to tests/integration_tests/db_engine_specs/athena_tests.py index bb53d8ee03..484788f137 100644 --- a/tests/db_engine_specs/athena_tests.py +++ b/tests/integration_tests/db_engine_specs/athena_tests.py @@ -16,7 +16,7 @@ # under the License. from superset.db_engine_specs.athena import AthenaEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestAthenaDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/base_engine_spec_tests.py b/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py similarity index 99% rename from tests/db_engine_specs/base_engine_spec_tests.py rename to tests/integration_tests/db_engine_specs/base_engine_spec_tests.py index b937eeadad..3b69a0729b 100644 --- a/tests/db_engine_specs/base_engine_spec_tests.py +++ b/tests/integration_tests/db_engine_specs/base_engine_spec_tests.py @@ -31,8 +31,8 @@ from superset.db_engine_specs.sqlite import SqliteEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.sql_parse import ParsedQuery from superset.utils.core import get_example_database -from tests.db_engine_specs.base_tests import TestDbEngineSpec -from tests.test_app import app +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.test_app import app from ..fixtures.energy_dashboard import load_energy_table_with_slice from ..fixtures.pyodbcRow import Row diff --git a/tests/db_engine_specs/base_tests.py b/tests/integration_tests/db_engine_specs/base_tests.py similarity index 94% rename from tests/db_engine_specs/base_tests.py rename to tests/integration_tests/db_engine_specs/base_tests.py index a0aee9ebdf..6496d4609a 100644 --- a/tests/db_engine_specs/base_tests.py +++ b/tests/integration_tests/db_engine_specs/base_tests.py @@ -18,8 +18,8 @@ from datetime import datetime from typing import Tuple, Type -from tests.test_app import app -from tests.base_tests import SupersetTestCase +from tests.integration_tests.test_app import app +from tests.integration_tests.base_tests import SupersetTestCase from superset.db_engine_specs.base import BaseEngineSpec from superset.models.core import Database from superset.utils.core import GenericDataType diff --git a/tests/db_engine_specs/bigquery_tests.py b/tests/integration_tests/db_engine_specs/bigquery_tests.py similarity index 99% rename from tests/db_engine_specs/bigquery_tests.py rename to tests/integration_tests/db_engine_specs/bigquery_tests.py index d21f3e3187..42022ff466 100644 --- a/tests/db_engine_specs/bigquery_tests.py +++ b/tests/integration_tests/db_engine_specs/bigquery_tests.py @@ -24,7 +24,7 @@ from superset.db_engine_specs.base import BaseEngineSpec from superset.db_engine_specs.bigquery import BigQueryEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.sql_parse import Table -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestBigQueryDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/clickhouse_tests.py b/tests/integration_tests/db_engine_specs/clickhouse_tests.py similarity index 95% rename from tests/db_engine_specs/clickhouse_tests.py rename to tests/integration_tests/db_engine_specs/clickhouse_tests.py index c6f506cdf4..c8019a8758 100644 --- a/tests/db_engine_specs/clickhouse_tests.py +++ b/tests/integration_tests/db_engine_specs/clickhouse_tests.py @@ -20,7 +20,7 @@ import pytest from superset.db_engine_specs.clickhouse import ClickHouseEngineSpec from superset.db_engine_specs.exceptions import SupersetDBAPIDatabaseError -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestClickHouseDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/crate_tests.py b/tests/integration_tests/db_engine_specs/crate_tests.py similarity index 96% rename from tests/db_engine_specs/crate_tests.py rename to tests/integration_tests/db_engine_specs/crate_tests.py index c385ea29a0..7c86b34b33 100644 --- a/tests/db_engine_specs/crate_tests.py +++ b/tests/integration_tests/db_engine_specs/crate_tests.py @@ -17,7 +17,7 @@ from superset.connectors.sqla.models import SqlaTable, TableColumn from superset.db_engine_specs.crate import CrateEngineSpec from superset.models.core import Database -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestCrateDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/dremio_tests.py b/tests/integration_tests/db_engine_specs/dremio_tests.py similarity index 94% rename from tests/db_engine_specs/dremio_tests.py rename to tests/integration_tests/db_engine_specs/dremio_tests.py index 02d21c653c..5d678c947b 100644 --- a/tests/db_engine_specs/dremio_tests.py +++ b/tests/integration_tests/db_engine_specs/dremio_tests.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. from superset.db_engine_specs.dremio import DremioEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestDremioDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/drill_tests.py b/tests/integration_tests/db_engine_specs/drill_tests.py similarity index 94% rename from tests/db_engine_specs/drill_tests.py rename to tests/integration_tests/db_engine_specs/drill_tests.py index 9897a5dccc..e89462ee5f 100644 --- a/tests/db_engine_specs/drill_tests.py +++ b/tests/integration_tests/db_engine_specs/drill_tests.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. from superset.db_engine_specs.drill import DrillEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestDrillDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/druid_tests.py b/tests/integration_tests/db_engine_specs/druid_tests.py similarity index 92% rename from tests/db_engine_specs/druid_tests.py rename to tests/integration_tests/db_engine_specs/druid_tests.py index 3ff561640b..142acdfbf6 100644 --- a/tests/db_engine_specs/druid_tests.py +++ b/tests/integration_tests/db_engine_specs/druid_tests.py @@ -19,9 +19,9 @@ from unittest import mock from sqlalchemy import column from superset.db_engine_specs.druid import DruidEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec -from tests.fixtures.certificates import ssl_certificate -from tests.fixtures.database import default_db_extra +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.fixtures.certificates import ssl_certificate +from tests.integration_tests.fixtures.database import default_db_extra class TestDruidDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/elasticsearch_tests.py b/tests/integration_tests/db_engine_specs/elasticsearch_tests.py similarity index 96% rename from tests/db_engine_specs/elasticsearch_tests.py rename to tests/integration_tests/db_engine_specs/elasticsearch_tests.py index fd0dcc7e97..92c25aa843 100644 --- a/tests/db_engine_specs/elasticsearch_tests.py +++ b/tests/integration_tests/db_engine_specs/elasticsearch_tests.py @@ -22,7 +22,7 @@ from superset.db_engine_specs.elasticsearch import ( ElasticSearchEngineSpec, OpenDistroEngineSpec, ) -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestElasticSearchDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/firebird_tests.py b/tests/integration_tests/db_engine_specs/firebird_tests.py similarity index 100% rename from tests/db_engine_specs/firebird_tests.py rename to tests/integration_tests/db_engine_specs/firebird_tests.py diff --git a/tests/db_engine_specs/gsheets_tests.py b/tests/integration_tests/db_engine_specs/gsheets_tests.py similarity index 95% rename from tests/db_engine_specs/gsheets_tests.py rename to tests/integration_tests/db_engine_specs/gsheets_tests.py index e9a021d8dc..fe34b72667 100644 --- a/tests/db_engine_specs/gsheets_tests.py +++ b/tests/integration_tests/db_engine_specs/gsheets_tests.py @@ -16,7 +16,7 @@ # under the License. from superset.db_engine_specs.gsheets import GSheetsEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestGsheetsDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/hana_tests.py b/tests/integration_tests/db_engine_specs/hana_tests.py similarity index 94% rename from tests/db_engine_specs/hana_tests.py rename to tests/integration_tests/db_engine_specs/hana_tests.py index cdc8aeb414..06eee032e8 100644 --- a/tests/db_engine_specs/hana_tests.py +++ b/tests/integration_tests/db_engine_specs/hana_tests.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. from superset.db_engine_specs.hana import HanaEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestHanaDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/hive_tests.py b/tests/integration_tests/db_engine_specs/hive_tests.py similarity index 99% rename from tests/db_engine_specs/hive_tests.py rename to tests/integration_tests/db_engine_specs/hive_tests.py index 1e978b71bf..76a4370fa0 100644 --- a/tests/db_engine_specs/hive_tests.py +++ b/tests/integration_tests/db_engine_specs/hive_tests.py @@ -25,7 +25,7 @@ from sqlalchemy.sql import select from superset.db_engine_specs.hive import HiveEngineSpec, upload_to_s3 from superset.exceptions import SupersetException from superset.sql_parse import Table, ParsedQuery -from tests.test_app import app +from tests.integration_tests.test_app import app def test_0_progress(): diff --git a/tests/db_engine_specs/impala_tests.py b/tests/integration_tests/db_engine_specs/impala_tests.py similarity index 93% rename from tests/db_engine_specs/impala_tests.py rename to tests/integration_tests/db_engine_specs/impala_tests.py index 8d2e40392b..936ace98be 100644 --- a/tests/db_engine_specs/impala_tests.py +++ b/tests/integration_tests/db_engine_specs/impala_tests.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. from superset.db_engine_specs.impala import ImpalaEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestImpalaDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/kylin_tests.py b/tests/integration_tests/db_engine_specs/kylin_tests.py similarity index 93% rename from tests/db_engine_specs/kylin_tests.py rename to tests/integration_tests/db_engine_specs/kylin_tests.py index 8e6c0204d0..a607565d5b 100644 --- a/tests/db_engine_specs/kylin_tests.py +++ b/tests/integration_tests/db_engine_specs/kylin_tests.py @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. from superset.db_engine_specs.kylin import KylinEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestKylinDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/mssql_tests.py b/tests/integration_tests/db_engine_specs/mssql_tests.py similarity index 99% rename from tests/db_engine_specs/mssql_tests.py rename to tests/integration_tests/db_engine_specs/mssql_tests.py index b37bb371ce..005493dc87 100644 --- a/tests/db_engine_specs/mssql_tests.py +++ b/tests/integration_tests/db_engine_specs/mssql_tests.py @@ -27,7 +27,7 @@ from superset.db_engine_specs.base import BaseEngineSpec from superset.db_engine_specs.mssql import MssqlEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.utils.core import GenericDataType -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestMssqlEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/mysql_tests.py b/tests/integration_tests/db_engine_specs/mysql_tests.py similarity index 98% rename from tests/db_engine_specs/mysql_tests.py rename to tests/integration_tests/db_engine_specs/mysql_tests.py index 7f0755ac13..857d769681 100644 --- a/tests/db_engine_specs/mysql_tests.py +++ b/tests/integration_tests/db_engine_specs/mysql_tests.py @@ -22,7 +22,10 @@ from sqlalchemy.dialects.mysql import DATE, NVARCHAR, TEXT, VARCHAR from superset.db_engine_specs.mysql import MySQLEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.utils.core import GenericDataType -from tests.db_engine_specs.base_tests import assert_generic_types, TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import ( + assert_generic_types, + TestDbEngineSpec, +) class TestMySQLEngineSpecsDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/oracle_tests.py b/tests/integration_tests/db_engine_specs/oracle_tests.py similarity index 97% rename from tests/db_engine_specs/oracle_tests.py rename to tests/integration_tests/db_engine_specs/oracle_tests.py index 4f476ab39e..b2f4f9f231 100644 --- a/tests/db_engine_specs/oracle_tests.py +++ b/tests/integration_tests/db_engine_specs/oracle_tests.py @@ -22,7 +22,7 @@ from sqlalchemy.dialects import oracle from sqlalchemy.dialects.oracle import DATE, NVARCHAR, VARCHAR from superset.db_engine_specs.oracle import OracleEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestOracleDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/pinot_tests.py b/tests/integration_tests/db_engine_specs/pinot_tests.py similarity index 97% rename from tests/db_engine_specs/pinot_tests.py rename to tests/integration_tests/db_engine_specs/pinot_tests.py index c38a22d500..fa31efdb38 100644 --- a/tests/db_engine_specs/pinot_tests.py +++ b/tests/integration_tests/db_engine_specs/pinot_tests.py @@ -17,7 +17,7 @@ from sqlalchemy import column from superset.db_engine_specs.pinot import PinotEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestPinotDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/postgres_tests.py b/tests/integration_tests/db_engine_specs/postgres_tests.py similarity index 98% rename from tests/db_engine_specs/postgres_tests.py rename to tests/integration_tests/db_engine_specs/postgres_tests.py index 7f999f07db..a437d93805 100644 --- a/tests/db_engine_specs/postgres_tests.py +++ b/tests/integration_tests/db_engine_specs/postgres_tests.py @@ -24,9 +24,12 @@ from superset.db_engine_specs import get_engine_specs from superset.db_engine_specs.postgres import PostgresEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.utils.core import GenericDataType -from tests.db_engine_specs.base_tests import assert_generic_types, TestDbEngineSpec -from tests.fixtures.certificates import ssl_certificate -from tests.fixtures.database import default_db_extra +from tests.integration_tests.db_engine_specs.base_tests import ( + assert_generic_types, + TestDbEngineSpec, +) +from tests.integration_tests.fixtures.certificates import ssl_certificate +from tests.integration_tests.fixtures.database import default_db_extra class TestPostgresDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/presto_tests.py b/tests/integration_tests/db_engine_specs/presto_tests.py similarity index 99% rename from tests/db_engine_specs/presto_tests.py rename to tests/integration_tests/db_engine_specs/presto_tests.py index 336c01e5de..3b48f67886 100644 --- a/tests/db_engine_specs/presto_tests.py +++ b/tests/integration_tests/db_engine_specs/presto_tests.py @@ -26,7 +26,7 @@ from superset.db_engine_specs.presto import PrestoEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.sql_parse import ParsedQuery from superset.utils.core import DatasourceName, GenericDataType -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestPrestoDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/redshift_tests.py b/tests/integration_tests/db_engine_specs/redshift_tests.py similarity index 98% rename from tests/db_engine_specs/redshift_tests.py rename to tests/integration_tests/db_engine_specs/redshift_tests.py index 49e34b1586..cdfe8d16cb 100644 --- a/tests/db_engine_specs/redshift_tests.py +++ b/tests/integration_tests/db_engine_specs/redshift_tests.py @@ -18,7 +18,7 @@ from textwrap import dedent from superset.db_engine_specs.redshift import RedshiftEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestRedshiftDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/snowflake_tests.py b/tests/integration_tests/db_engine_specs/snowflake_tests.py similarity index 97% rename from tests/db_engine_specs/snowflake_tests.py rename to tests/integration_tests/db_engine_specs/snowflake_tests.py index 14ca728df1..1be0de08e3 100644 --- a/tests/db_engine_specs/snowflake_tests.py +++ b/tests/integration_tests/db_engine_specs/snowflake_tests.py @@ -19,7 +19,7 @@ import json from superset.db_engine_specs.snowflake import SnowflakeEngineSpec from superset.errors import ErrorLevel, SupersetError, SupersetErrorType from superset.models.core import Database -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestSnowflakeDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/sqlite_tests.py b/tests/integration_tests/db_engine_specs/sqlite_tests.py similarity index 97% rename from tests/db_engine_specs/sqlite_tests.py rename to tests/integration_tests/db_engine_specs/sqlite_tests.py index bb4a19f7c5..7d98b6b6fa 100644 --- a/tests/db_engine_specs/sqlite_tests.py +++ b/tests/integration_tests/db_engine_specs/sqlite_tests.py @@ -17,7 +17,7 @@ from unittest import mock from superset.db_engine_specs.sqlite import SqliteEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestSQliteDbEngineSpec(TestDbEngineSpec): diff --git a/tests/db_engine_specs/trino_tests.py b/tests/integration_tests/db_engine_specs/trino_tests.py similarity index 96% rename from tests/db_engine_specs/trino_tests.py rename to tests/integration_tests/db_engine_specs/trino_tests.py index 557d3bda26..211d00405e 100644 --- a/tests/db_engine_specs/trino_tests.py +++ b/tests/integration_tests/db_engine_specs/trino_tests.py @@ -17,7 +17,7 @@ from sqlalchemy.engine.url import URL from superset.db_engine_specs.trino import TrinoEngineSpec -from tests.db_engine_specs.base_tests import TestDbEngineSpec +from tests.integration_tests.db_engine_specs.base_tests import TestDbEngineSpec class TestTrinoDbEngineSpec(TestDbEngineSpec): diff --git a/tests/dict_import_export_tests.py b/tests/integration_tests/dict_import_export_tests.py similarity index 99% rename from tests/dict_import_export_tests.py rename to tests/integration_tests/dict_import_export_tests.py index 176ecd0754..922b10be88 100644 --- a/tests/dict_import_export_tests.py +++ b/tests/integration_tests/dict_import_export_tests.py @@ -22,7 +22,7 @@ from uuid import uuid4 import yaml -from tests.test_app import app +from tests.integration_tests.test_app import app from superset import db from superset.connectors.druid.models import ( DruidColumn, diff --git a/tests/druid_func_tests.py b/tests/integration_tests/druid_func_tests.py similarity index 99% rename from tests/druid_func_tests.py rename to tests/integration_tests/druid_func_tests.py index a8b16922f5..af310810d7 100644 --- a/tests/druid_func_tests.py +++ b/tests/integration_tests/druid_func_tests.py @@ -19,7 +19,7 @@ import json import unittest from unittest.mock import Mock -import tests.test_app +import tests.integration_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/druid_func_tests_sip38.py b/tests/integration_tests/druid_func_tests_sip38.py similarity index 99% rename from tests/druid_func_tests_sip38.py rename to tests/integration_tests/druid_func_tests_sip38.py index fb2837e70a..79bd130f55 100644 --- a/tests/druid_func_tests_sip38.py +++ b/tests/integration_tests/druid_func_tests_sip38.py @@ -19,7 +19,7 @@ import json import unittest from unittest.mock import Mock, patch -import tests.test_app +import tests.integration_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/druid_tests.py b/tests/integration_tests/druid_tests.py similarity index 99% rename from tests/druid_tests.py rename to tests/integration_tests/druid_tests.py index 09f2d6101a..a9c787ecc8 100644 --- a/tests/druid_tests.py +++ b/tests/integration_tests/druid_tests.py @@ -21,7 +21,7 @@ import unittest from datetime import datetime from unittest.mock import Mock, patch -from tests.test_app import app +from tests.integration_tests.test_app import app from superset import db, security_manager from superset.connectors.druid.views import ( diff --git a/tests/dynamic_plugins_tests.py b/tests/integration_tests/dynamic_plugins_tests.py similarity index 100% rename from tests/dynamic_plugins_tests.py rename to tests/integration_tests/dynamic_plugins_tests.py diff --git a/tests/email_tests.py b/tests/integration_tests/email_tests.py similarity index 99% rename from tests/email_tests.py rename to tests/integration_tests/email_tests.py index 89b0c4b142..d6c46a08d9 100644 --- a/tests/email_tests.py +++ b/tests/integration_tests/email_tests.py @@ -26,7 +26,7 @@ from unittest import mock from superset import app from superset.utils import core as utils -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase from .utils import read_fixture diff --git a/tests/event_logger_tests.py b/tests/integration_tests/event_logger_tests.py similarity index 99% rename from tests/event_logger_tests.py rename to tests/integration_tests/event_logger_tests.py index 5727da7c39..ddbe42bb4f 100644 --- a/tests/event_logger_tests.py +++ b/tests/integration_tests/event_logger_tests.py @@ -30,7 +30,7 @@ from superset.utils.log import ( DBEventLogger, get_event_logger_from_cfg_value, ) -from tests.test_app import app +from tests.integration_tests.test_app import app class TestEventLogger(unittest.TestCase): diff --git a/tests/feature_flag_tests.py b/tests/integration_tests/feature_flag_tests.py similarity index 95% rename from tests/feature_flag_tests.py rename to tests/integration_tests/feature_flag_tests.py index 2ce9649be5..500cb572e5 100644 --- a/tests/feature_flag_tests.py +++ b/tests/integration_tests/feature_flag_tests.py @@ -17,7 +17,7 @@ from unittest.mock import patch from superset import is_feature_enabled -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class TestFeatureFlag(SupersetTestCase): diff --git a/tests/integration_tests/fixtures/__init__.py b/tests/integration_tests/fixtures/__init__.py new file mode 100644 index 0000000000..d3531aa29e --- /dev/null +++ b/tests/integration_tests/fixtures/__init__.py @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from .birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, + load_birth_names_dashboard_with_slices_module_scope, +) +from .energy_dashboard import load_energy_table_with_slice +from .public_role import public_role_like_gamma, public_role_like_test_role +from .unicode_dashboard import ( + load_unicode_dashboard_with_position, + load_unicode_dashboard_with_slice, +) +from .world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, + load_world_bank_dashboard_with_slices_module_scope, +) diff --git a/tests/fixtures/birth_names_dashboard.py b/tests/integration_tests/fixtures/birth_names_dashboard.py similarity index 97% rename from tests/fixtures/birth_names_dashboard.py rename to tests/integration_tests/fixtures/birth_names_dashboard.py index d9368fe71d..67ea016e26 100644 --- a/tests/fixtures/birth_names_dashboard.py +++ b/tests/integration_tests/fixtures/birth_names_dashboard.py @@ -31,8 +31,8 @@ from superset.models.core import Database from superset.models.dashboard import Dashboard from superset.models.slice import Slice from superset.utils.core import get_example_database -from tests.dashboard_utils import create_table_for_dashboard -from tests.test_app import app +from tests.integration_tests.dashboard_utils import create_table_for_dashboard +from tests.integration_tests.test_app import app @pytest.fixture() diff --git a/tests/fixtures/certificates.py b/tests/integration_tests/fixtures/certificates.py similarity index 100% rename from tests/fixtures/certificates.py rename to tests/integration_tests/fixtures/certificates.py diff --git a/tests/fixtures/database.py b/tests/integration_tests/fixtures/database.py similarity index 100% rename from tests/fixtures/database.py rename to tests/integration_tests/fixtures/database.py diff --git a/tests/fixtures/dataframes.py b/tests/integration_tests/fixtures/dataframes.py similarity index 100% rename from tests/fixtures/dataframes.py rename to tests/integration_tests/fixtures/dataframes.py diff --git a/tests/fixtures/datasource.py b/tests/integration_tests/fixtures/datasource.py similarity index 100% rename from tests/fixtures/datasource.py rename to tests/integration_tests/fixtures/datasource.py diff --git a/tests/fixtures/deck_geojson_form_data.json b/tests/integration_tests/fixtures/deck_geojson_form_data.json similarity index 100% rename from tests/fixtures/deck_geojson_form_data.json rename to tests/integration_tests/fixtures/deck_geojson_form_data.json diff --git a/tests/fixtures/deck_path_form_data.json b/tests/integration_tests/fixtures/deck_path_form_data.json similarity index 100% rename from tests/fixtures/deck_path_form_data.json rename to tests/integration_tests/fixtures/deck_path_form_data.json diff --git a/tests/fixtures/energy_dashboard.py b/tests/integration_tests/fixtures/energy_dashboard.py similarity index 97% rename from tests/fixtures/energy_dashboard.py rename to tests/integration_tests/fixtures/energy_dashboard.py index 42fb46ead7..2c25eecdc2 100644 --- a/tests/fixtures/energy_dashboard.py +++ b/tests/integration_tests/fixtures/energy_dashboard.py @@ -28,8 +28,11 @@ from superset.connectors.sqla.models import SqlaTable, SqlMetric from superset.models.dashboard import Dashboard from superset.models.slice import Slice from superset.utils.core import get_example_database -from tests.dashboard_utils import create_slice, create_table_for_dashboard -from tests.test_app import app +from tests.integration_tests.dashboard_utils import ( + create_slice, + create_table_for_dashboard, +) +from tests.integration_tests.test_app import app misc_dash_slices: Set[str] = set() diff --git a/tests/fixtures/importexport.py b/tests/integration_tests/fixtures/importexport.py similarity index 100% rename from tests/fixtures/importexport.py rename to tests/integration_tests/fixtures/importexport.py diff --git a/tests/fixtures/public_role.py b/tests/integration_tests/fixtures/public_role.py similarity index 96% rename from tests/fixtures/public_role.py rename to tests/integration_tests/fixtures/public_role.py index 0e3dc8cd10..892098b401 100644 --- a/tests/fixtures/public_role.py +++ b/tests/integration_tests/fixtures/public_role.py @@ -17,7 +17,7 @@ import pytest from superset.extensions import db, security_manager -from tests.test_app import app +from tests.integration_tests.test_app import app @pytest.fixture() diff --git a/tests/fixtures/pyodbcRow.py b/tests/integration_tests/fixtures/pyodbcRow.py similarity index 100% rename from tests/fixtures/pyodbcRow.py rename to tests/integration_tests/fixtures/pyodbcRow.py diff --git a/tests/fixtures/query_context.py b/tests/integration_tests/fixtures/query_context.py similarity index 99% rename from tests/fixtures/query_context.py rename to tests/integration_tests/fixtures/query_context.py index d0486a42ee..268e403875 100644 --- a/tests/fixtures/query_context.py +++ b/tests/integration_tests/fixtures/query_context.py @@ -18,7 +18,7 @@ import copy from typing import Any, Dict, List from superset.utils.core import AnnotationType, DTTM_ALIAS, TimeRangeEndpoint -from tests.base_tests import get_table_by_name +from tests.integration_tests.base_tests import get_table_by_name query_birth_names = { "extras": { diff --git a/tests/fixtures/sample.png b/tests/integration_tests/fixtures/sample.png similarity index 100% rename from tests/fixtures/sample.png rename to tests/integration_tests/fixtures/sample.png diff --git a/tests/fixtures/trends.csv b/tests/integration_tests/fixtures/trends.csv similarity index 100% rename from tests/fixtures/trends.csv rename to tests/integration_tests/fixtures/trends.csv diff --git a/tests/fixtures/unicode_dashboard.py b/tests/integration_tests/fixtures/unicode_dashboard.py similarity index 97% rename from tests/fixtures/unicode_dashboard.py rename to tests/integration_tests/fixtures/unicode_dashboard.py index 02dbd4c378..c670e086b7 100644 --- a/tests/fixtures/unicode_dashboard.py +++ b/tests/integration_tests/fixtures/unicode_dashboard.py @@ -24,12 +24,12 @@ from superset.connectors.sqla.models import SqlaTable from superset.models.dashboard import Dashboard from superset.models.slice import Slice from superset.utils.core import get_example_database -from tests.dashboard_utils import ( +from tests.integration_tests.dashboard_utils import ( create_dashboard, create_slice, create_table_for_dashboard, ) -from tests.test_app import app +from tests.integration_tests.test_app import app @pytest.fixture() diff --git a/tests/fixtures/world_bank_dashboard.py b/tests/integration_tests/fixtures/world_bank_dashboard.py similarity index 99% rename from tests/fixtures/world_bank_dashboard.py rename to tests/integration_tests/fixtures/world_bank_dashboard.py index 4f27b56cc9..5e59067746 100644 --- a/tests/fixtures/world_bank_dashboard.py +++ b/tests/integration_tests/fixtures/world_bank_dashboard.py @@ -30,8 +30,11 @@ from superset.models.core import Database from superset.models.dashboard import Dashboard from superset.models.slice import Slice from superset.utils.core import get_example_database -from tests.dashboard_utils import create_dashboard, create_table_for_dashboard -from tests.test_app import app +from tests.integration_tests.dashboard_utils import ( + create_dashboard, + create_table_for_dashboard, +) +from tests.integration_tests.test_app import app @pytest.fixture() diff --git a/tests/form_tests.py b/tests/integration_tests/form_tests.py similarity index 96% rename from tests/form_tests.py rename to tests/integration_tests/form_tests.py index 92aea641ce..b15dfdea79 100644 --- a/tests/form_tests.py +++ b/tests/integration_tests/form_tests.py @@ -17,7 +17,7 @@ from wtforms.form import Form from superset.forms import CommaSeparatedListField, filter_not_empty_values -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class TestForm(SupersetTestCase): diff --git a/tests/import_export_tests.py b/tests/integration_tests/import_export_tests.py similarity index 98% rename from tests/import_export_tests.py rename to tests/integration_tests/import_export_tests.py index 4aaf8fbc66..7dbc7beea3 100644 --- a/tests/import_export_tests.py +++ b/tests/integration_tests/import_export_tests.py @@ -18,14 +18,18 @@ """Unit tests for Superset""" import json import unittest -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) import pytest from flask import g from sqlalchemy.orm.session import make_transient -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.test_app import app +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.test_app import app from superset.dashboards.commands.importers.v0 import decode_dashboards from superset import db, security_manager from superset.connectors.druid.models import ( @@ -41,7 +45,9 @@ from superset.models.dashboard import Dashboard from superset.models.slice import Slice from superset.utils.core import get_example_database -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) from .base_tests import SupersetTestCase diff --git a/tests/importexport/commands_tests.py b/tests/integration_tests/importexport/commands_tests.py similarity index 96% rename from tests/importexport/commands_tests.py rename to tests/integration_tests/importexport/commands_tests.py index a8055c1b90..230462d097 100644 --- a/tests/importexport/commands_tests.py +++ b/tests/integration_tests/importexport/commands_tests.py @@ -23,7 +23,7 @@ from freezegun import freeze_time from superset import security_manager from superset.databases.commands.export import ExportDatabasesCommand from superset.utils.core import get_example_database -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class TestExportModelsCommand(SupersetTestCase): diff --git a/tests/insert_chart_mixin.py b/tests/integration_tests/insert_chart_mixin.py similarity index 100% rename from tests/insert_chart_mixin.py rename to tests/integration_tests/insert_chart_mixin.py diff --git a/tests/jinja_context_tests.py b/tests/integration_tests/jinja_context_tests.py similarity index 98% rename from tests/jinja_context_tests.py rename to tests/integration_tests/jinja_context_tests.py index 0628bbe87a..a990968e5a 100644 --- a/tests/jinja_context_tests.py +++ b/tests/integration_tests/jinja_context_tests.py @@ -21,12 +21,12 @@ from unittest import mock import pytest -import tests.test_app +import tests.integration_tests.test_app from superset import app from superset.exceptions import SupersetTemplateException from superset.jinja_context import ExtraCache, get_template_processor, safe_proxy from superset.utils import core as utils -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class TestJinja2Context(SupersetTestCase): @@ -323,7 +323,9 @@ class TestJinja2Context(SupersetTestCase): rendered = tp.process_template(s) self.assertEqual("SELECT '2017-01-01T00:00:00'", rendered) - @mock.patch("tests.superset_test_custom_template_processors.datetime") + @mock.patch( + "tests.integration_tests.superset_test_custom_template_processors.datetime" + ) def test_custom_process_template(self, mock_dt) -> None: """Test macro defined in custom template processor works.""" mock_dt.utcnow = mock.Mock(return_value=datetime(1970, 1, 1)) diff --git a/tests/log_api_tests.py b/tests/integration_tests/log_api_tests.py similarity index 100% rename from tests/log_api_tests.py rename to tests/integration_tests/log_api_tests.py diff --git a/tests/log_model_view_tests.py b/tests/integration_tests/log_model_view_tests.py similarity index 100% rename from tests/log_model_view_tests.py rename to tests/integration_tests/log_model_view_tests.py diff --git a/tests/logging_configurator_tests.py b/tests/integration_tests/logging_configurator_tests.py similarity index 100% rename from tests/logging_configurator_tests.py rename to tests/integration_tests/logging_configurator_tests.py diff --git a/tests/migration_tests.py b/tests/integration_tests/migration_tests.py similarity index 100% rename from tests/migration_tests.py rename to tests/integration_tests/migration_tests.py diff --git a/tests/migrations/__init__.py b/tests/integration_tests/migrations/__init__.py similarity index 100% rename from tests/migrations/__init__.py rename to tests/integration_tests/migrations/__init__.py diff --git a/tests/migrations/f1410ed7ec95_tests.py b/tests/integration_tests/migrations/f1410ed7ec95_tests.py similarity index 100% rename from tests/migrations/f1410ed7ec95_tests.py rename to tests/integration_tests/migrations/f1410ed7ec95_tests.py diff --git a/tests/migrations/fc3a3a8ff221_tests.py b/tests/integration_tests/migrations/fc3a3a8ff221_tests.py similarity index 100% rename from tests/migrations/fc3a3a8ff221_tests.py rename to tests/integration_tests/migrations/fc3a3a8ff221_tests.py diff --git a/tests/model_tests.py b/tests/integration_tests/model_tests.py similarity index 99% rename from tests/model_tests.py rename to tests/integration_tests/model_tests.py index 83b826ff80..74387a18d1 100644 --- a/tests/model_tests.py +++ b/tests/integration_tests/model_tests.py @@ -18,13 +18,15 @@ import textwrap import unittest from unittest import mock -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) import pandas import pytest from sqlalchemy.engine.url import make_url -import tests.test_app +import tests.integration_tests.test_app from superset import app, db as metadata_db from superset.models.core import Database from superset.models.slice import Slice diff --git a/tests/pandas_postprocessing_tests.py b/tests/integration_tests/pandas_postprocessing_tests.py similarity index 100% rename from tests/pandas_postprocessing_tests.py rename to tests/integration_tests/pandas_postprocessing_tests.py diff --git a/tests/queries/__init__.py b/tests/integration_tests/queries/__init__.py similarity index 100% rename from tests/queries/__init__.py rename to tests/integration_tests/queries/__init__.py diff --git a/tests/queries/api_tests.py b/tests/integration_tests/queries/api_tests.py similarity index 99% rename from tests/queries/api_tests.py rename to tests/integration_tests/queries/api_tests.py index a2fc02fe75..e734af1654 100644 --- a/tests/queries/api_tests.py +++ b/tests/integration_tests/queries/api_tests.py @@ -25,13 +25,13 @@ import pytest import prison from sqlalchemy.sql import func -import tests.test_app +import tests.integration_tests.test_app from superset import db, security_manager from superset.models.core import Database from superset.utils.core import get_example_database, get_main_database, QueryStatus from superset.models.sql_lab import Query -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase QUERIES_FIXTURE_COUNT = 10 diff --git a/tests/queries/saved_queries/__init__.py b/tests/integration_tests/queries/saved_queries/__init__.py similarity index 100% rename from tests/queries/saved_queries/__init__.py rename to tests/integration_tests/queries/saved_queries/__init__.py diff --git a/tests/queries/saved_queries/api_tests.py b/tests/integration_tests/queries/saved_queries/api_tests.py similarity index 99% rename from tests/queries/saved_queries/api_tests.py rename to tests/integration_tests/queries/saved_queries/api_tests.py index bfffebf00c..7cb150894b 100644 --- a/tests/queries/saved_queries/api_tests.py +++ b/tests/integration_tests/queries/saved_queries/api_tests.py @@ -26,15 +26,15 @@ import pytest import prison from sqlalchemy.sql import func, and_ -import tests.test_app +import tests.integration_tests.test_app from superset import db from superset.models.core import Database from superset.models.core import FavStar from superset.models.sql_lab import SavedQuery from superset.utils.core import get_example_database -from tests.base_tests import SupersetTestCase -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.importexport import ( database_config, saved_queries_config, saved_queries_metadata_config, diff --git a/tests/queries/saved_queries/commands_tests.py b/tests/integration_tests/queries/saved_queries/commands_tests.py similarity index 98% rename from tests/queries/saved_queries/commands_tests.py rename to tests/integration_tests/queries/saved_queries/commands_tests.py index aad393673e..1bf4b26cab 100644 --- a/tests/queries/saved_queries/commands_tests.py +++ b/tests/integration_tests/queries/saved_queries/commands_tests.py @@ -31,8 +31,8 @@ from superset.queries.saved_queries.commands.importers.v1 import ( ImportSavedQueriesCommand, ) from superset.utils.core import get_example_database -from tests.base_tests import SupersetTestCase -from tests.fixtures.importexport import ( +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.importexport import ( database_config, database_metadata_config, saved_queries_config, diff --git a/tests/query_context_tests.py b/tests/integration_tests/query_context_tests.py similarity index 98% rename from tests/query_context_tests.py rename to tests/integration_tests/query_context_tests.py index 660bcddccf..520b666d20 100644 --- a/tests/query_context_tests.py +++ b/tests/integration_tests/query_context_tests.py @@ -32,9 +32,11 @@ from superset.utils.core import ( ChartDataResultType, TimeRangeEndpoint, ) -from tests.base_tests import SupersetTestCase -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.query_context import get_query_context +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.query_context import get_query_context def get_sql_text(payload: Dict[str, Any]) -> str: diff --git a/tests/reports/__init__.py b/tests/integration_tests/reports/__init__.py similarity index 100% rename from tests/reports/__init__.py rename to tests/integration_tests/reports/__init__.py diff --git a/tests/reports/api_tests.py b/tests/integration_tests/reports/api_tests.py similarity index 99% rename from tests/reports/api_tests.py rename to tests/integration_tests/reports/api_tests.py index 24abfaf8b9..995aa22f03 100644 --- a/tests/reports/api_tests.py +++ b/tests/integration_tests/reports/api_tests.py @@ -36,10 +36,12 @@ from superset.models.reports import ( ReportState, ) from superset.utils.core import get_example_database -from tests.base_tests import SupersetTestCase -from tests.conftest import with_feature_flags -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.reports.utils import insert_report_schedule +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.conftest import with_feature_flags +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.reports.utils import insert_report_schedule REPORTS_COUNT = 10 diff --git a/tests/reports/commands_tests.py b/tests/integration_tests/reports/commands_tests.py similarity index 99% rename from tests/reports/commands_tests.py rename to tests/integration_tests/reports/commands_tests.py index e274f9c040..7321b384a6 100644 --- a/tests/reports/commands_tests.py +++ b/tests/integration_tests/reports/commands_tests.py @@ -58,13 +58,15 @@ from superset.reports.commands.exceptions import ( from superset.reports.commands.execute import AsyncExecuteReportScheduleCommand from superset.reports.commands.log_prune import AsyncPruneReportScheduleLogCommand from superset.utils.core import get_example_database -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.world_bank_dashboard import ( +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.world_bank_dashboard import ( load_world_bank_dashboard_with_slices_module_scope, ) -from tests.reports.utils import insert_report_schedule -from tests.test_app import app -from tests.utils import read_fixture +from tests.integration_tests.reports.utils import insert_report_schedule +from tests.integration_tests.test_app import app +from tests.integration_tests.utils import read_fixture pytestmark = pytest.mark.usefixtures( "load_world_bank_dashboard_with_slices_module_scope" diff --git a/tests/reports/scheduler_tests.py b/tests/integration_tests/reports/scheduler_tests.py similarity index 96% rename from tests/reports/scheduler_tests.py rename to tests/integration_tests/reports/scheduler_tests.py index afbaeec905..36e49a137d 100644 --- a/tests/reports/scheduler_tests.py +++ b/tests/integration_tests/reports/scheduler_tests.py @@ -24,8 +24,8 @@ from freezegun.api import FakeDatetime # type: ignore from superset.extensions import db from superset.models.reports import ReportScheduleType from superset.tasks.scheduler import cron_schedule_window, scheduler -from tests.reports.utils import insert_report_schedule -from tests.test_app import app +from tests.integration_tests.reports.utils import insert_report_schedule +from tests.integration_tests.test_app import app @pytest.mark.parametrize( diff --git a/tests/reports/utils.py b/tests/integration_tests/reports/utils.py similarity index 100% rename from tests/reports/utils.py rename to tests/integration_tests/reports/utils.py diff --git a/tests/result_set_tests.py b/tests/integration_tests/result_set_tests.py similarity index 99% rename from tests/result_set_tests.py rename to tests/integration_tests/result_set_tests.py index 888b695688..bd44661d8d 100644 --- a/tests/result_set_tests.py +++ b/tests/integration_tests/result_set_tests.py @@ -17,7 +17,7 @@ # isort:skip_file from datetime import datetime -import tests.test_app +import tests.integration_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/schedules_test.py b/tests/integration_tests/schedules_test.py similarity index 98% rename from tests/schedules_test.py rename to tests/integration_tests/schedules_test.py index dd7a2a71c4..c47bf5fc86 100644 --- a/tests/schedules_test.py +++ b/tests/integration_tests/schedules_test.py @@ -24,8 +24,10 @@ import pytest from selenium.common.exceptions import WebDriverException from slack import errors, WebClient -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices -from tests.test_app import app +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) +from tests.integration_tests.test_app import app from superset import db from superset.models.dashboard import Dashboard from superset.models.schedules import ( @@ -41,8 +43,8 @@ from superset.tasks.schedules import ( next_schedules, ) from superset.models.slice import Slice -from tests.base_tests import SupersetTestCase -from tests.utils import read_fixture +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.utils import read_fixture class TestSchedules(SupersetTestCase): diff --git a/tests/security/__init__.py b/tests/integration_tests/security/__init__.py similarity index 100% rename from tests/security/__init__.py rename to tests/integration_tests/security/__init__.py diff --git a/tests/security/analytics_db_safety_tests.py b/tests/integration_tests/security/analytics_db_safety_tests.py similarity index 96% rename from tests/security/analytics_db_safety_tests.py rename to tests/integration_tests/security/analytics_db_safety_tests.py index ebab520f7a..f6518fe935 100644 --- a/tests/security/analytics_db_safety_tests.py +++ b/tests/integration_tests/security/analytics_db_safety_tests.py @@ -20,7 +20,7 @@ from sqlalchemy.engine.url import make_url from superset.exceptions import SupersetSecurityException from superset.security.analytics_db_safety import check_sqlalchemy_uri -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class TestDBConnections(SupersetTestCase): diff --git a/tests/security/api_tests.py b/tests/integration_tests/security/api_tests.py similarity index 96% rename from tests/security/api_tests.py rename to tests/integration_tests/security/api_tests.py index d103877683..8cae667cd0 100644 --- a/tests/security/api_tests.py +++ b/tests/integration_tests/security/api_tests.py @@ -19,7 +19,7 @@ """Unit tests for Superset""" import json -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase from flask_wtf.csrf import generate_csrf diff --git a/tests/security/migrate_roles_tests.py b/tests/integration_tests/security/migrate_roles_tests.py similarity index 99% rename from tests/security/migrate_roles_tests.py rename to tests/integration_tests/security/migrate_roles_tests.py index 81f067a48e..96ed064853 100644 --- a/tests/security/migrate_roles_tests.py +++ b/tests/integration_tests/security/migrate_roles_tests.py @@ -30,7 +30,7 @@ from superset.migrations.shared.security_converge import ( Pvm, PvmMigrationMapType, ) -from tests.test_app import app +from tests.integration_tests.test_app import app logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) diff --git a/tests/security_tests.py b/tests/integration_tests/security_tests.py similarity index 99% rename from tests/security_tests.py rename to tests/integration_tests/security_tests.py index a59118183a..009082c2f4 100644 --- a/tests/security_tests.py +++ b/tests/integration_tests/security_tests.py @@ -42,14 +42,22 @@ from superset.utils.core import get_example_database from superset.views.access_requests import AccessRequestsModelView from .base_tests import SupersetTestCase -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.energy_dashboard import load_energy_table_with_slice -from tests.fixtures.public_role import ( +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.energy_dashboard import ( + load_energy_table_with_slice, +) +from tests.integration_tests.fixtures.public_role import ( public_role_like_gamma, public_role_like_test_role, ) -from tests.fixtures.unicode_dashboard import load_unicode_dashboard_with_slice -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.fixtures.unicode_dashboard import ( + load_unicode_dashboard_with_slice, +) +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) NEW_SECURITY_CONVERGE_VIEWS = ( "Annotation", diff --git a/tests/sql_parse_tests.py b/tests/integration_tests/sql_parse_tests.py similarity index 100% rename from tests/sql_parse_tests.py rename to tests/integration_tests/sql_parse_tests.py diff --git a/tests/sql_validator_tests.py b/tests/integration_tests/sql_validator_tests.py similarity index 100% rename from tests/sql_validator_tests.py rename to tests/integration_tests/sql_validator_tests.py diff --git a/tests/sqla_models_tests.py b/tests/integration_tests/sqla_models_tests.py similarity index 99% rename from tests/sqla_models_tests.py rename to tests/integration_tests/sqla_models_tests.py index edd9dce5f0..b60cdcca77 100644 --- a/tests/sqla_models_tests.py +++ b/tests/integration_tests/sqla_models_tests.py @@ -32,7 +32,9 @@ from superset.utils.core import ( GenericDataType, get_example_database, ) -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) from .base_tests import SupersetTestCase diff --git a/tests/sqla_views_tests.py b/tests/integration_tests/sqla_views_tests.py similarity index 92% rename from tests/sqla_views_tests.py rename to tests/integration_tests/sqla_views_tests.py index 532d6e8eb6..92c350c878 100644 --- a/tests/sqla_views_tests.py +++ b/tests/integration_tests/sqla_views_tests.py @@ -14,8 +14,8 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from tests.base_tests import SupersetTestCase -from tests.conftest import with_feature_flags +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.conftest import with_feature_flags class TestRowLevelSecurityFiltersModelView(SupersetTestCase): diff --git a/tests/sqllab_tests.py b/tests/integration_tests/sqllab_tests.py similarity index 99% rename from tests/sqllab_tests.py rename to tests/integration_tests/sqllab_tests.py index a69c1c8e82..442001fe10 100644 --- a/tests/sqllab_tests.py +++ b/tests/integration_tests/sqllab_tests.py @@ -51,7 +51,9 @@ from superset.utils.core import ( from .base_tests import SupersetTestCase from .conftest import CTAS_SCHEMA_NAME -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) QUERY_1 = "SELECT * FROM birth_names LIMIT 1" QUERY_2 = "SELECT * FROM NO_TABLE" diff --git a/tests/stats_logger_tests.py b/tests/integration_tests/stats_logger_tests.py similarity index 100% rename from tests/stats_logger_tests.py rename to tests/integration_tests/stats_logger_tests.py diff --git a/tests/strategy_tests.py b/tests/integration_tests/strategy_tests.py similarity index 98% rename from tests/strategy_tests.py rename to tests/integration_tests/strategy_tests.py index bba560f642..1ba41d65bf 100644 --- a/tests/strategy_tests.py +++ b/tests/integration_tests/strategy_tests.py @@ -19,7 +19,9 @@ import datetime import json from unittest.mock import MagicMock -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) from sqlalchemy import String, Date, Float diff --git a/tests/superset_test_config.py b/tests/integration_tests/superset_test_config.py similarity index 93% rename from tests/superset_test_config.py rename to tests/integration_tests/superset_test_config.py index 22afcc04e2..96bea2b020 100644 --- a/tests/superset_test_config.py +++ b/tests/integration_tests/superset_test_config.py @@ -18,10 +18,14 @@ from copy import copy from superset.config import * -from tests.superset_test_custom_template_processors import CustomPrestoTemplateProcessor +from tests.integration_tests.superset_test_custom_template_processors import ( + CustomPrestoTemplateProcessor, +) AUTH_USER_REGISTRATION_ROLE = "alpha" -SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(DATA_DIR, "unittests.db") +SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join( + DATA_DIR, "unittests.integration_tests.db" +) DEBUG = False SUPERSET_WEBSERVER_PORT = 8081 @@ -43,7 +47,7 @@ if "sqlite" in SQLALCHEMY_DATABASE_URI: "removed in a future version of Superset." ) -# Speeding up the tests. +# Speeding up the tests.integration_tests. PRESTO_POLL_INTERVAL = 0.1 HIVE_POLL_INTERVAL = 0.1 diff --git a/tests/superset_test_config_sqllab_backend_persist.py b/tests/integration_tests/superset_test_config_sqllab_backend_persist.py similarity index 100% rename from tests/superset_test_config_sqllab_backend_persist.py rename to tests/integration_tests/superset_test_config_sqllab_backend_persist.py diff --git a/tests/superset_test_config_thumbnails.py b/tests/integration_tests/superset_test_config_thumbnails.py similarity index 96% rename from tests/superset_test_config_thumbnails.py rename to tests/integration_tests/superset_test_config_thumbnails.py index ddd59987ee..964164cf79 100644 --- a/tests/superset_test_config_thumbnails.py +++ b/tests/integration_tests/superset_test_config_thumbnails.py @@ -20,7 +20,9 @@ from copy import copy from superset.config import * AUTH_USER_REGISTRATION_ROLE = "alpha" -SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(DATA_DIR, "unittests.db") +SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join( + DATA_DIR, "unittests.integration_tests.db" +) DEBUG = True SUPERSET_WEBSERVER_PORT = 8081 diff --git a/tests/superset_test_custom_template_processors.py b/tests/integration_tests/superset_test_custom_template_processors.py similarity index 100% rename from tests/superset_test_custom_template_processors.py rename to tests/integration_tests/superset_test_custom_template_processors.py diff --git a/tests/tagging_tests.py b/tests/integration_tests/tagging_tests.py similarity index 90% rename from tests/tagging_tests.py rename to tests/integration_tests/tagging_tests.py index d19f2abe1f..9ae8764d40 100644 --- a/tests/tagging_tests.py +++ b/tests/integration_tests/tagging_tests.py @@ -15,8 +15,8 @@ # specific language governing permissions and limitations # under the License. -from tests.base_tests import SupersetTestCase -from tests.conftest import with_feature_flags +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.conftest import with_feature_flags class TestTagging(SupersetTestCase): diff --git a/tests/tasks/__init__.py b/tests/integration_tests/tasks/__init__.py similarity index 100% rename from tests/tasks/__init__.py rename to tests/integration_tests/tasks/__init__.py diff --git a/tests/tasks/async_queries_tests.py b/tests/integration_tests/tasks/async_queries_tests.py similarity index 96% rename from tests/tasks/async_queries_tests.py rename to tests/integration_tests/tasks/async_queries_tests.py index 6914854cad..8743374569 100644 --- a/tests/tasks/async_queries_tests.py +++ b/tests/integration_tests/tasks/async_queries_tests.py @@ -34,10 +34,12 @@ from superset.tasks.async_queries import ( load_chart_data_into_cache, load_explore_json_into_cache, ) -from tests.base_tests import SupersetTestCase -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices -from tests.fixtures.query_context import get_query_context -from tests.test_app import app +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) +from tests.integration_tests.fixtures.query_context import get_query_context +from tests.integration_tests.test_app import app def get_table_by_name(name: str) -> SqlaTable: diff --git a/tests/test_app.py b/tests/integration_tests/test_app.py similarity index 96% rename from tests/test_app.py rename to tests/integration_tests/test_app.py index f3e708b550..798f3e9cda 100644 --- a/tests/test_app.py +++ b/tests/integration_tests/test_app.py @@ -16,7 +16,7 @@ # under the License. """ -Here is where we create the app which ends up being shared across all tests. A future +Here is where we create the app which ends up being shared across all tests.integration_tests. A future optimization will be to create a separate app instance for each test class. """ from superset.app import create_app diff --git a/tests/thumbnails_tests.py b/tests/integration_tests/thumbnails_tests.py similarity index 98% rename from tests/thumbnails_tests.py rename to tests/integration_tests/thumbnails_tests.py index 92d4f9993d..62366e48de 100644 --- a/tests/thumbnails_tests.py +++ b/tests/integration_tests/thumbnails_tests.py @@ -31,8 +31,8 @@ from superset.models.slice import Slice from superset.utils.screenshots import ChartScreenshot, DashboardScreenshot from superset.utils.urls import get_url_host, get_url_path from superset.utils.webdriver import WebDriverProxy -from tests.conftest import with_feature_flags -from tests.test_app import app +from tests.integration_tests.conftest import with_feature_flags +from tests.integration_tests.test_app import app from .base_tests import SupersetTestCase diff --git a/tests/utils/__init__.py b/tests/integration_tests/utils/__init__.py similarity index 95% rename from tests/utils/__init__.py rename to tests/integration_tests/utils/__init__.py index 832ddd5d88..d493d5b634 100644 --- a/tests/utils/__init__.py +++ b/tests/integration_tests/utils/__init__.py @@ -17,7 +17,7 @@ import json from os import path -FIXTURES_DIR = "tests/fixtures" +FIXTURES_DIR = "tests/integration_tests/fixtures" def read_fixture(fixture_file_name): diff --git a/tests/utils/core_tests.py b/tests/integration_tests/utils/core_tests.py similarity index 100% rename from tests/utils/core_tests.py rename to tests/integration_tests/utils/core_tests.py diff --git a/tests/utils/csv_tests.py b/tests/integration_tests/utils/csv_tests.py similarity index 100% rename from tests/utils/csv_tests.py rename to tests/integration_tests/utils/csv_tests.py diff --git a/tests/utils/date_parser_tests.py b/tests/integration_tests/utils/date_parser_tests.py similarity index 99% rename from tests/utils/date_parser_tests.py rename to tests/integration_tests/utils/date_parser_tests.py index ad87f40dc8..f04f0da45f 100644 --- a/tests/utils/date_parser_tests.py +++ b/tests/integration_tests/utils/date_parser_tests.py @@ -29,7 +29,7 @@ from superset.utils.date_parser import ( parse_human_timedelta, parse_past_timedelta, ) -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase def mock_parse_human_datetime(s): diff --git a/tests/utils/decorators_tests.py b/tests/integration_tests/utils/decorators_tests.py similarity index 96% rename from tests/utils/decorators_tests.py rename to tests/integration_tests/utils/decorators_tests.py index 8481254692..98faa8a2ba 100644 --- a/tests/utils/decorators_tests.py +++ b/tests/integration_tests/utils/decorators_tests.py @@ -17,7 +17,7 @@ from unittest.mock import call, Mock from superset.utils import decorators -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class UtilsDecoratorsTests(SupersetTestCase): diff --git a/tests/utils/encrypt_tests.py b/tests/integration_tests/utils/encrypt_tests.py similarity index 97% rename from tests/utils/encrypt_tests.py rename to tests/integration_tests/utils/encrypt_tests.py index e131b9224a..2199783529 100644 --- a/tests/utils/encrypt_tests.py +++ b/tests/integration_tests/utils/encrypt_tests.py @@ -22,7 +22,7 @@ from sqlalchemy_utils.types.encrypted.encrypted_type import StringEncryptedType from superset.extensions import encrypted_field_factory from superset.utils.encrypt import AbstractEncryptedFieldAdapter, SQLAlchemyUtilsAdapter -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class CustomEncFieldAdapter(AbstractEncryptedFieldAdapter): diff --git a/tests/utils/get_dashboards.py b/tests/integration_tests/utils/get_dashboards.py similarity index 100% rename from tests/utils/get_dashboards.py rename to tests/integration_tests/utils/get_dashboards.py diff --git a/tests/utils/hashing_tests.py b/tests/integration_tests/utils/hashing_tests.py similarity index 100% rename from tests/utils/hashing_tests.py rename to tests/integration_tests/utils/hashing_tests.py diff --git a/tests/utils/machine_auth_tests.py b/tests/integration_tests/utils/machine_auth_tests.py similarity index 97% rename from tests/utils/machine_auth_tests.py rename to tests/integration_tests/utils/machine_auth_tests.py index 1bc08e8eb5..0dc8d4a124 100644 --- a/tests/utils/machine_auth_tests.py +++ b/tests/integration_tests/utils/machine_auth_tests.py @@ -18,7 +18,7 @@ from unittest.mock import call, Mock, patch from superset.extensions import machine_auth_provider_factory -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase class MachineAuthProviderTests(SupersetTestCase): diff --git a/tests/utils/public_interfaces_test.py b/tests/integration_tests/utils/public_interfaces_test.py similarity index 98% rename from tests/utils/public_interfaces_test.py rename to tests/integration_tests/utils/public_interfaces_test.py index 65612c36b3..03bd0dee42 100644 --- a/tests/utils/public_interfaces_test.py +++ b/tests/integration_tests/utils/public_interfaces_test.py @@ -19,7 +19,7 @@ import pytest from superset.sql_lab import dummy_sql_query_mutator from superset.utils.public_interfaces import compute_hash, get_warning_message -from tests.base_tests import SupersetTestCase +from tests.integration_tests.base_tests import SupersetTestCase # These are public interfaces exposed by Superset. Make sure # to only change the interfaces and update the hashes in new diff --git a/tests/utils_tests.py b/tests/integration_tests/utils_tests.py similarity index 99% rename from tests/utils_tests.py rename to tests/integration_tests/utils_tests.py index 5781965ae8..86b5957fd5 100644 --- a/tests/utils_tests.py +++ b/tests/integration_tests/utils_tests.py @@ -24,7 +24,9 @@ import os import re from typing import Any, Tuple, List, Optional from unittest.mock import Mock, patch -from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices +from tests.integration_tests.fixtures.birth_names_dashboard import ( + load_birth_names_dashboard_with_slices, +) import numpy as np import pandas as pd @@ -33,7 +35,7 @@ from flask import Flask, g import marshmallow from sqlalchemy.exc import ArgumentError -import tests.test_app +import tests.integration_tests.test_app from superset import app, db, security_manager from superset.exceptions import CertificateException, SupersetException from superset.models.core import Database, Log @@ -76,8 +78,10 @@ from superset.views.utils import ( get_form_data, get_time_range_endpoints, ) -from tests.base_tests import SupersetTestCase -from tests.fixtures.world_bank_dashboard import load_world_bank_dashboard_with_slices +from tests.integration_tests.base_tests import SupersetTestCase +from tests.integration_tests.fixtures.world_bank_dashboard import ( + load_world_bank_dashboard_with_slices, +) from .fixtures.certificates import ssl_certificate diff --git a/tests/viz_tests.py b/tests/integration_tests/viz_tests.py similarity index 99% rename from tests/viz_tests.py rename to tests/integration_tests/viz_tests.py index fd2572dbc5..c3370ab754 100644 --- a/tests/viz_tests.py +++ b/tests/integration_tests/viz_tests.py @@ -25,7 +25,7 @@ import numpy as np import pandas as pd import pytest -import tests.test_app +import tests.integration_tests.test_app import superset.viz as viz from superset import app from superset.constants import NULL_STRING diff --git a/tests/unit_tests/__init__.py b/tests/unit_tests/__init__.py new file mode 100644 index 0000000000..13a83393a9 --- /dev/null +++ b/tests/unit_tests/__init__.py @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. diff --git a/tox.ini b/tox.ini index 39bc8e534f..839bce5586 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ deps = setenv = PYTHONPATH = {toxinidir} SUPERSET_TESTENV = true - SUPERSET_CONFIG = tests.superset_test_config + SUPERSET_CONFIG = tests.integration_tests.superset_test_config SUPERSET_HOME = {envtmpdir} mysql: SUPERSET__SQLALCHEMY_DATABASE_URI = mysql://mysqluser:mysqluserpassword@localhost/superset?charset=utf8 postgres: SUPERSET__SQLALCHEMY_DATABASE_URI = postgresql+psycopg2://superset:superset@localhost/test @@ -54,7 +54,7 @@ allowlist_externals = setenv = PYTHONPATH = {toxinidir} SUPERSET_TESTENV = true - SUPERSET_CONFIG = tests.superset_test_config + SUPERSET_CONFIG = tests.integration_tests.superset_test_config SUPERSET_HOME = {envtmpdir} ENABLE_REACT_CRUD_VIEWS = true commands = @@ -68,7 +68,7 @@ commands_post = setenv = PYTHONPATH = {toxinidir} SUPERSET_TESTENV = true - SUPERSET_CONFIG = tests.superset_test_config + SUPERSET_CONFIG = tests.integration_tests.superset_test_config SUPERSET_HOME = {envtmpdir} ENABLE_REACT_CRUD_VIEWS = true commands = @@ -82,7 +82,7 @@ commands_post = setenv = PYTHONPATH = {toxinidir} SUPERSET_TESTENV = true - SUPERSET_CONFIG = tests.superset_test_config + SUPERSET_CONFIG = tests.integration_tests.superset_test_config SUPERSET_HOME = {envtmpdir} ENABLE_REACT_CRUD_VIEWS = true commands = @@ -96,7 +96,7 @@ commands_post = setenv = PYTHONPATH = {toxinidir} SUPERSET_TESTENV = true - SUPERSET_CONFIG = tests.superset_test_config + SUPERSET_CONFIG = tests.integration_tests.superset_test_config SUPERSET_HOME = {envtmpdir} ENABLE_REACT_CRUD_VIEWS = true commands = @@ -110,7 +110,7 @@ commands_post = setenv = PYTHONPATH = {toxinidir} SUPERSET_TESTENV = true - SUPERSET_CONFIG = tests.superset_test_config + SUPERSET_CONFIG = tests.integration_tests.superset_test_config SUPERSET_HOME = {envtmpdir} ENABLE_REACT_CRUD_VIEWS = true commands = @@ -161,7 +161,7 @@ deps = [testenv:thumbnails] setenv = - SUPERSET_CONFIG = tests.superset_test_config_thumbnails + SUPERSET_CONFIG = tests.integration_tests.superset_test_config_thumbnails deps = -rrequirements/testing.txt