From commits-return-85401-archive-asf-public=cust-asf.ponee.io@airflow.apache.org Wed Jan 1 12:13:50 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id BA39F180630 for ; Wed, 1 Jan 2020 13:13:49 +0100 (CET) Received: (qmail 74878 invoked by uid 500); 1 Jan 2020 12:13:49 -0000 Mailing-List: contact commits-help@airflow.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.apache.org Delivered-To: mailing list commits@airflow.apache.org Received: (qmail 74869 invoked by uid 99); 1 Jan 2020 12:13:49 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jan 2020 12:13:49 +0000 From: GitBox To: commits@airflow.apache.org Subject: [GitHub] [airflow] potiuk commented on a change in pull request #6761: [AIRFLOW-6204] Add GCP system tests helper Message-ID: <157788082900.1854.7729591194390465720.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Wed, 01 Jan 2020 12:13:49 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit potiuk commented on a change in pull request #6761: [AIRFLOW-6204] Add GCP system tests helper URL: https://github.com/apache/airflow/pull/6761#discussion_r362319567 ########## 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() +@pytest.fixture +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 +@GcpSystemTest.skip(GCP_MEMORYSTORE) +@pytest.mark.usefixtures("helper") +def test_run_example_dag(): Review comment: Why wait for abandoning development of 1.10.x? We already moved to pytest in 1.10 as well (I cherry-picked all the changes there and 1.10.7 already uses pytest). We also updated 1.10.7 documentation with information that we use pytest and that we should (for example) prefer standard python asserts which are overwritten by pytest. I don't think abandoning 1.10 line has anything to do with pytest. We already as community agreed to go pytest-first (there was vote about it). ---------------------------------------------------------------- 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 With regards, Apache Git Services