You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/10/04 08:37:39 UTC

[GitHub] [incubator-superset] villebro commented on a change in pull request #11131: test: removed unicode_test example from unit tests

villebro commented on a change in pull request #11131:
URL: https://github.com/apache/incubator-superset/pull/11131#discussion_r499220155



##########
File path: tests/dashboard_utils.py
##########
@@ -0,0 +1,78 @@
+# 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.
+# isort:skip_file
+"""Utils to provide dashboards for tests"""
+
+import json
+
+from pandas import DataFrame
+from typing import Dict, Any
+
+from superset import db, ConnectorRegistry
+from superset.models.dashboard import Dashboard
+from superset.models.slice import Slice
+
+
+def create_table_for_dashboard(
+    df: DataFrame, tbl_name: str, database, schema: Dict[str, Any]

Review comment:
       nit: `database: Database`. I assume this will cause a circular import, which we can get around by doing
   
   ```python
   from typing import TYPE_CHECKING
   
   if TYPE_CHECKING:
       from superset.models.core import Database
   
   def create_table_for_dashboard(
       df: DataFrame, tbl_name: str, database: "Database", schema: Dict[str, Any]
   ):
   ```
   The same can be applied to the return type.

##########
File path: tests/strategy_tests.py
##########
@@ -193,6 +204,39 @@ def reset_tag(self, tag):
                 db.session.delete(o)
             db.session.commit()
 
+    @pytest.fixture()
+    def load_unicode_dashboard(self):

Review comment:
       Same here (move to `fixtures.py`)

##########
File path: tests/security_tests.py
##########
@@ -1122,6 +1132,41 @@ def test_rls_filter_doesnt_alter_energy_query(self):
         assert tbl.get_extra_cache_keys(self.query_obj) == []
         assert "value > 1" not in sql
 
+    @pytest.fixture()
+    def load_unicode_dashboard(self):

Review comment:
       Should we put this in `fixtures.py` so we don't have to repeat this logic wherever we use the unicode dashboard?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org