mik-laj commented on a change in pull request #6761: [AIRFLOW-6204] Add GCP 
system tests helper
URL: https://github.com/apache/airflow/pull/6761#discussion_r362319110
 
 

 ##########
 File path: tests/gcp/operators/test_cloud_memorystore_system.py
 ##########
 @@ -18,31 +18,35 @@
 # under the License.
 """System tests for Google Cloud Memorystore operators"""
 
-from tests.gcp.operators.test_cloud_memorystore_system_helper import 
GCPCloudMemorystoreTestHelper
+import pytest
+
+from airflow.gcp.example_dags.example_cloud_memorystore import BUCKET_NAME
 from tests.gcp.utils.gcp_authenticator import GCP_MEMORYSTORE  # TODO: Update 
it
-from tests.test_utils.gcp_system_helpers import GCP_DAG_FOLDER, 
provide_gcp_context, skip_gcp_system
-from tests.test_utils.system_tests_class import SystemTest
+from tests.test_utils.gcp_system_helpers import GCP_DAG_FOLDER, GcpSystemTest, 
provide_gcp_context
+
+command = GcpSystemTest.commands_registry()
+
+
+@command
+def create_bucket():
+    GcpSystemTest.create_gcs_bucket(BUCKET_NAME, location="europe-north1")
 
 
-@skip_gcp_system(GCP_MEMORYSTORE, require_local_executor=True)
-class CloudBuildExampleDagsSystemTest(SystemTest):
-    """
-    System tests for Google Cloud Memorystore operators
+@command
+def delete_bucket():
+    GcpSystemTest.delete_gcs_bucket(BUCKET_NAME)
 
-    It use a real service.
-    """
-    helper = GCPCloudMemorystoreTestHelper()
 
-    @provide_gcp_context(GCP_MEMORYSTORE)
-    def setUp(self):
-        super().setUp()
-        self.helper.create_bucket()
[email protected]
+def helper():
+    create_bucket()
+    yield
+    delete_bucket()
 
-    @provide_gcp_context(GCP_MEMORYSTORE)
-    def test_run_example_dag(self):
-        self.run_dag('gcp_cloud_memorystore', GCP_DAG_FOLDER)
 
-    @provide_gcp_context(GCP_MEMORYSTORE)
-    def tearDown(self):
-        self.helper.delete_bucket()
-        super().tearDown()
+@command
[email protected](GCP_MEMORYSTORE)
[email protected]("helper")
+def test_run_example_dag():
 
 Review comment:
   I think we should wait with full migration on the pytest syntax until we 
abandon the development of the 1.10.x line.  Now there may be low awareness 
about how to write tests using pytest, so we cannot require knowledge of it. 
Such decision-making should be made at the level of the entire project and we 
should send links and materials that will allow for easy familiarization. 
pytest is not part of the standard library, so not everyone knows it.
   
https://lists.apache.org/thread.html/08b64d3b084c865399f98f6c6f56235ce5329e843d97938e1a8045a5%40%3Cdev.airflow.apache.org%3Ehttps://lists.apache.org/thread.html/08b64d3b084c865399f98f6c6f56235ce5329e843d97938e1a8045a5%40%3Cdev.airflow.apache.org%3E

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to