Repository: dbt-labs/dbt-core

Issue:
[CT-2576] Move all tests in test/unit to tests/unit
Right now we have two different directories of unit tests, test/unit and tests/unit. Combine them all in tests/unit.  The tests in test/unit still mostly use unittest instead of pytest, but there's not a lot of appetite for converting them because the difference in functionality isn't as big as it was for the functional tests.


Discussion:

Resolving patch:
diff --git a/core/dbt/clients/jinja_static.py b/core/dbt/clients/jinja_static.py
--- a/core/dbt/clients/jinja_static.py
+++ b/core/dbt/clients/jinja_static.py
@@ -141,7 +141,7 @@ def statically_parse_adapter_dispatch(func_call, ctx, db_wrapper):
         macro = db_wrapper.dispatch(func_name, macro_namespace=macro_namespace).macro
         func_name = f"{macro.package_name}.{macro.name}"
         possible_macro_calls.append(func_name)
-    else:  # this is only for test/unit/test_macro_calls.py
+    else:  # this is only for tests/unit/test_macro_calls.py
         if macro_namespace:
             packages = [macro_namespace]
         else:


Test patch:
diff --git a/test/unit/__init__.py b/test/unit/__init__.py
deleted file mode 100644
diff --git a/test/unit/README.md b/tests/unit/README.md
similarity index 100%
rename from test/unit/README.md
rename to tests/unit/README.md
diff --git a/test/unit/mock_adapter.py b/tests/unit/mock_adapter.py
similarity index 100%
rename from test/unit/mock_adapter.py
rename to tests/unit/mock_adapter.py
diff --git a/test/unit/test_adapter_connection_manager.py b/tests/unit/test_adapter_connection_manager.py
similarity index 100%
rename from test/unit/test_adapter_connection_manager.py
rename to tests/unit/test_adapter_connection_manager.py
diff --git a/test/unit/test_adapter_factory.py b/tests/unit/test_adapter_factory.py
similarity index 100%
rename from test/unit/test_adapter_factory.py
rename to tests/unit/test_adapter_factory.py
diff --git a/test/unit/test_agate_helper.py b/tests/unit/test_agate_helper.py
similarity index 100%
rename from test/unit/test_agate_helper.py
rename to tests/unit/test_agate_helper.py
diff --git a/test/unit/test_base_column.py b/tests/unit/test_base_column.py
similarity index 100%
rename from test/unit/test_base_column.py
rename to tests/unit/test_base_column.py
diff --git a/test/unit/test_cache.py b/tests/unit/test_cache.py
similarity index 100%
rename from test/unit/test_cache.py
rename to tests/unit/test_cache.py
diff --git a/test/unit/test_compiler.py b/tests/unit/test_compiler.py
similarity index 100%
rename from test/unit/test_compiler.py
rename to tests/unit/test_compiler.py
diff --git a/test/unit/test_config.py b/tests/unit/test_config.py
similarity index 100%
rename from test/unit/test_config.py
rename to tests/unit/test_config.py
diff --git a/test/unit/test_context.py b/tests/unit/test_context.py
similarity index 100%
rename from test/unit/test_context.py
rename to tests/unit/test_context.py
diff --git a/test/unit/test_contracts_graph_compiled.py b/tests/unit/test_contracts_graph_compiled.py
similarity index 100%
rename from test/unit/test_contracts_graph_compiled.py
rename to tests/unit/test_contracts_graph_compiled.py
diff --git a/test/unit/test_contracts_graph_parsed.py b/tests/unit/test_contracts_graph_parsed.py
similarity index 100%
rename from test/unit/test_contracts_graph_parsed.py
rename to tests/unit/test_contracts_graph_parsed.py
diff --git a/test/unit/test_contracts_graph_unparsed.py b/tests/unit/test_contracts_graph_unparsed.py
similarity index 100%
rename from test/unit/test_contracts_graph_unparsed.py
rename to tests/unit/test_contracts_graph_unparsed.py
diff --git a/test/unit/test_contracts_project.py b/tests/unit/test_contracts_project.py
similarity index 100%
rename from test/unit/test_contracts_project.py
rename to tests/unit/test_contracts_project.py
diff --git a/test/unit/test_core_dbt_utils.py b/tests/unit/test_core_dbt_utils.py
similarity index 100%
rename from test/unit/test_core_dbt_utils.py
rename to tests/unit/test_core_dbt_utils.py
diff --git a/test/unit/test_deps.py b/tests/unit/test_deps.py
similarity index 100%
rename from test/unit/test_deps.py
rename to tests/unit/test_deps.py
diff --git a/test/unit/test_docs_blocks.py b/tests/unit/test_docs_blocks.py
similarity index 100%
rename from test/unit/test_docs_blocks.py
rename to tests/unit/test_docs_blocks.py
diff --git a/test/unit/test_docs_generate.py b/tests/unit/test_docs_generate.py
similarity index 100%
rename from test/unit/test_docs_generate.py
rename to tests/unit/test_docs_generate.py
diff --git a/test/unit/test_flags.py b/tests/unit/test_flags.py
similarity index 100%
rename from test/unit/test_flags.py
rename to tests/unit/test_flags.py
diff --git a/test/unit/test_graph.py b/tests/unit/test_graph.py
similarity index 100%
rename from test/unit/test_graph.py
rename to tests/unit/test_graph.py
diff --git a/test/unit/test_graph_selection.py b/tests/unit/test_graph_selection.py
similarity index 100%
rename from test/unit/test_graph_selection.py
rename to tests/unit/test_graph_selection.py
diff --git a/test/unit/test_graph_selector_methods.py b/tests/unit/test_graph_selector_methods.py
similarity index 100%
rename from test/unit/test_graph_selector_methods.py
rename to tests/unit/test_graph_selector_methods.py
diff --git a/test/unit/test_graph_selector_parsing.py b/tests/unit/test_graph_selector_parsing.py
similarity index 100%
rename from test/unit/test_graph_selector_parsing.py
rename to tests/unit/test_graph_selector_parsing.py
diff --git a/test/unit/test_graph_selector_spec.py b/tests/unit/test_graph_selector_spec.py
similarity index 100%
rename from test/unit/test_graph_selector_spec.py
rename to tests/unit/test_graph_selector_spec.py
diff --git a/test/unit/test_jinja.py b/tests/unit/test_jinja.py
similarity index 100%
rename from test/unit/test_jinja.py
rename to tests/unit/test_jinja.py
diff --git a/test/unit/test_linker.py b/tests/unit/test_linker.py
similarity index 100%
rename from test/unit/test_linker.py
rename to tests/unit/test_linker.py
diff --git a/test/unit/test_macro_calls.py b/tests/unit/test_macro_calls.py
similarity index 100%
rename from test/unit/test_macro_calls.py
rename to tests/unit/test_macro_calls.py
diff --git a/test/unit/test_macro_resolver.py b/tests/unit/test_macro_resolver.py
similarity index 100%
rename from test/unit/test_macro_resolver.py
rename to tests/unit/test_macro_resolver.py
diff --git a/test/unit/test_manifest.py b/tests/unit/test_manifest.py
similarity index 100%
rename from test/unit/test_manifest.py
rename to tests/unit/test_manifest.py
diff --git a/test/unit/test_manifest_selectors.py b/tests/unit/test_manifest_selectors.py
similarity index 100%
rename from test/unit/test_manifest_selectors.py
rename to tests/unit/test_manifest_selectors.py
diff --git a/test/unit/test_model_config.py b/tests/unit/test_model_config.py
similarity index 100%
rename from test/unit/test_model_config.py
rename to tests/unit/test_model_config.py
diff --git a/test/unit/test_node_types.py b/tests/unit/test_node_types.py
similarity index 100%
rename from test/unit/test_node_types.py
rename to tests/unit/test_node_types.py
diff --git a/test/unit/test_parse_manifest.py b/tests/unit/test_parse_manifest.py
similarity index 100%
rename from test/unit/test_parse_manifest.py
rename to tests/unit/test_parse_manifest.py
diff --git a/test/unit/test_parser.py b/tests/unit/test_parser.py
similarity index 100%
rename from test/unit/test_parser.py
rename to tests/unit/test_parser.py
diff --git a/test/unit/test_partial_parsing.py b/tests/unit/test_partial_parsing.py
similarity index 100%
rename from test/unit/test_partial_parsing.py
rename to tests/unit/test_partial_parsing.py
diff --git a/test/unit/test_postgres_adapter.py b/tests/unit/test_postgres_adapter.py
similarity index 100%
rename from test/unit/test_postgres_adapter.py
rename to tests/unit/test_postgres_adapter.py
diff --git a/test/unit/test_query_headers.py b/tests/unit/test_query_headers.py
similarity index 97%
rename from test/unit/test_query_headers.py
rename to tests/unit/test_query_headers.py
--- a/test/unit/test_query_headers.py
+++ b/tests/unit/test_query_headers.py
@@ -3,7 +3,7 @@
 
 from dbt.adapters.base.query_headers import MacroQueryStringSetter
 
-from test.unit.utils import config_from_parts_or_dicts
+from tests.unit.utils import config_from_parts_or_dicts
 
 
 class TestQueryHeaders(TestCase):
diff --git a/test/unit/test_registry_get_request_exception.py b/tests/unit/test_registry_get_request_exception.py
similarity index 100%
rename from test/unit/test_registry_get_request_exception.py
rename to tests/unit/test_registry_get_request_exception.py
diff --git a/test/unit/test_selector_errors.py b/tests/unit/test_selector_errors.py
similarity index 100%
rename from test/unit/test_selector_errors.py
rename to tests/unit/test_selector_errors.py
diff --git a/test/unit/test_semver.py b/tests/unit/test_semver.py
similarity index 100%
rename from test/unit/test_semver.py
rename to tests/unit/test_semver.py
diff --git a/test/unit/test_sql_result.py b/tests/unit/test_sql_result.py
similarity index 100%
rename from test/unit/test_sql_result.py
rename to tests/unit/test_sql_result.py
diff --git a/test/unit/test_system_client.py b/tests/unit/test_system_client.py
similarity index 100%
rename from test/unit/test_system_client.py
rename to tests/unit/test_system_client.py
diff --git a/test/unit/test_tracking.py b/tests/unit/test_tracking.py
similarity index 100%
rename from test/unit/test_tracking.py
rename to tests/unit/test_tracking.py
diff --git a/test/unit/test_utils.py b/tests/unit/test_utils.py
similarity index 100%
rename from test/unit/test_utils.py
rename to tests/unit/test_utils.py
diff --git a/test/unit/test_yaml_renderer.py b/tests/unit/test_yaml_renderer.py
similarity index 100%
rename from test/unit/test_yaml_renderer.py
rename to tests/unit/test_yaml_renderer.py
diff --git a/test/unit/utils.py b/tests/unit/utils.py
similarity index 100%
rename from test/unit/utils.py
rename to tests/unit/utils.py