You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2023/05/25 11:17:12 UTC

[GitHub] [superset] michael-s-molina commented on a diff in pull request #23712: feat: Migrates Pivot Table v1 to v2

michael-s-molina commented on code in PR #23712:
URL: https://github.com/apache/superset/pull/23712#discussion_r1205364955


##########
tests/unit_tests/conftest.py:
##########
@@ -163,3 +164,38 @@ def dummy_query_object(request, app_context):
         _datasource_dao=unittest.mock.Mock(),
         session_maker=unittest.mock.Mock(),
     ).create(parent_result_type=result_type, **query_object)
+
+
+def with_feature_flags(**mock_feature_flags):
+    """
+    Use this decorator to mock feature flags in tests.integration_tests.
+
+    Usage:
+
+        class TestYourFeature(SupersetTestCase):
+
+            @with_feature_flags(YOUR_FEATURE=True)
+            def test_your_feature_enabled(self):
+                self.assertEqual(is_feature_enabled("YOUR_FEATURE"), True)
+
+            @with_feature_flags(YOUR_FEATURE=False)
+            def test_your_feature_disabled(self):
+                self.assertEqual(is_feature_enabled("YOUR_FEATURE"), False)
+    """
+

Review Comment:
   Lets tackle this in a follow-up PR given that this is a copy/paste of the decorator found in the integration tests.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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