From d2fb6ba2e6d89df9b4cdeb4120e34bd7db282e2b Mon Sep 17 00:00:00 2001 From: yauheni_patotski Date: Wed, 23 Oct 2024 16:25:01 +0300 Subject: [PATCH] Added: 1. Python code coverage collection --- metadata-ingestion-modules/airflow-plugin/build.gradle | 6 ++++++ metadata-ingestion-modules/dagster-plugin/build.gradle | 7 +++++++ metadata-ingestion-modules/gx-plugin/build.gradle | 7 +++++++ metadata-ingestion-modules/prefect-plugin/build.gradle | 7 +++++++ metadata-ingestion/build.gradle | 8 ++++++++ 5 files changed, 35 insertions(+) diff --git a/metadata-ingestion-modules/airflow-plugin/build.gradle b/metadata-ingestion-modules/airflow-plugin/build.gradle index 9506609a10044a..b1e9cda519b4a2 100644 --- a/metadata-ingestion-modules/airflow-plugin/build.gradle +++ b/metadata-ingestion-modules/airflow-plugin/build.gradle @@ -100,6 +100,12 @@ task testQuick(type: Exec, dependsOn: installTest) { "pytest --cov-config=setup.cfg --cov-report xml:coverage_quick.xml -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" } +task generateCoverageReport(type: Exec, dependsOn: testQuick) { + outputs.dir("${venv_name}") + commandLine 'bash', '-c', + "source ${venv_name}/bin/activate && set -x && " + + "coverage html" +} task cleanPythonCache(type: Exec) { commandLine 'bash', '-c', diff --git a/metadata-ingestion-modules/dagster-plugin/build.gradle b/metadata-ingestion-modules/dagster-plugin/build.gradle index 0f11af9ca83d73..0e513f37681207 100644 --- a/metadata-ingestion-modules/dagster-plugin/build.gradle +++ b/metadata-ingestion-modules/dagster-plugin/build.gradle @@ -87,6 +87,13 @@ task testQuick(type: Exec, dependsOn: installDevTest) { "pytest -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" } +task generateCoverageReport(type: Exec, dependsOn: testQuick) { + outputs.dir("${venv_name}") + commandLine 'bash', '-c', + "source ${venv_name}/bin/activate && set -x && " + + "coverage html" +} + task buildWheel(type: Exec, dependsOn: [environmentSetup]) { commandLine 'bash', '-c', "source ${venv_name}/bin/activate && " + 'uv pip install build && RELEASE_VERSION="\${RELEASE_VERSION:-0.0.0.dev1}" RELEASE_SKIP_INSTALL=1 RELEASE_SKIP_UPLOAD=1 ./scripts/release.sh' diff --git a/metadata-ingestion-modules/gx-plugin/build.gradle b/metadata-ingestion-modules/gx-plugin/build.gradle index 2288ae6bd83961..ff36e7c5416546 100644 --- a/metadata-ingestion-modules/gx-plugin/build.gradle +++ b/metadata-ingestion-modules/gx-plugin/build.gradle @@ -87,6 +87,13 @@ task testQuick(type: Exec, dependsOn: installDevTest) { "pytest -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" } +task generateCoverageReport(type: Exec, dependsOn: testQuick) { + outputs.dir("${venv_name}") + commandLine 'bash', '-c', + "source ${venv_name}/bin/activate && set -x && " + + "coverage html" +} + task buildWheel(type: Exec, dependsOn: [environmentSetup]) { commandLine 'bash', '-c', "source ${venv_name}/bin/activate && " + 'uv pip install build && RELEASE_VERSION="\${RELEASE_VERSION:-0.0.0.dev1}" RELEASE_SKIP_INSTALL=1 RELEASE_SKIP_UPLOAD=1 ./scripts/release.sh' diff --git a/metadata-ingestion-modules/prefect-plugin/build.gradle b/metadata-ingestion-modules/prefect-plugin/build.gradle index bc091c64933645..dce23ed27c7383 100644 --- a/metadata-ingestion-modules/prefect-plugin/build.gradle +++ b/metadata-ingestion-modules/prefect-plugin/build.gradle @@ -92,6 +92,13 @@ task testFull(type: Exec, dependsOn: [testQuick, installDevTest]) { "pytest -m 'not slow_integration' -vv --continue-on-collection-errors --junit-xml=junit.full.xml" } +task generateCoverageReport(type: Exec, dependsOn: testFull) { + outputs.dir("${venv_name}") + commandLine 'bash', '-c', + "source ${venv_name}/bin/activate && set -x && " + + "coverage html" +} + task buildWheel(type: Exec, dependsOn: [environmentSetup]) { commandLine 'bash', '-c', "source ${venv_name}/bin/activate && " + diff --git a/metadata-ingestion/build.gradle b/metadata-ingestion/build.gradle index 4e3f1ca91766c2..552d3573d27d4b 100644 --- a/metadata-ingestion/build.gradle +++ b/metadata-ingestion/build.gradle @@ -148,6 +148,14 @@ task testQuick(type: Exec, dependsOn: [installDev, ':metadata-models:generateJso "pytest ${cvg_arg} tests/unit --random-order --durations=20 -m 'not integration' -vv --continue-on-collection-errors --junit-xml=junit.quick.xml" } +task generateCoverageReport(type: Exec, dependsOn: testQuick) { + outputs.dir("${venv_name}") + commandLine 'bash', '-c', + "source ${venv_name}/bin/activate && set -x && " + + "coverage html" +} + + task installDevTest(type: Exec, dependsOn: [install]) { def sentinel_file = "${venv_name}/.build_install_dev_test_sentinel" inputs.file file('setup.py')