From ec05219e4092d03f335da1ac5794801d88350eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Mancilla?= Date: Fri, 19 Nov 2021 21:33:39 -0300 Subject: [PATCH 1/2] apache-airflow: use pytestCheckHook --- .../python-modules/apache-airflow/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/apache-airflow/default.nix b/pkgs/development/python-modules/apache-airflow/default.nix index 2ffe0b137528..23fa5b6a860d 100644 --- a/pkgs/development/python-modules/apache-airflow/default.nix +++ b/pkgs/development/python-modules/apache-airflow/default.nix @@ -58,7 +58,7 @@ , termcolor , unicodecsv , werkzeug -, pytest +, pytestCheckHook , freezegun , mkYarnPackage }: @@ -171,7 +171,7 @@ buildPythonPackage rec { checkInputs = [ freezegun - pytest + pytestCheckHook ]; INSTALL_PROVIDERS_FROM_SOURCES = "true"; @@ -204,7 +204,7 @@ buildPythonPackage rec { # allow for gunicorn processes to have access to python packages makeWrapperArgs = [ "--prefix PYTHONPATH : $PYTHONPATH" ]; - checkPhase = '' + preCheck = '' export HOME=$(mktemp -d) export AIRFLOW_HOME=$HOME export AIRFLOW__CORE__UNIT_TEST_MODE=True @@ -214,10 +214,12 @@ buildPythonPackage rec { airflow version airflow db init airflow db reset -y - - pytest tests/core/test_core.py ''; + pytestFlagsArray = [ + "tests/core/test_core.py" + ]; + postInstall = '' cp -rv ${airflow-frontend}/static/dist $out/lib/${python.libPrefix}/site-packages/airflow/www/static ''; From 21d4d1bfdae4221013996cf6062ef493e6632e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Mancilla?= Date: Fri, 19 Nov 2021 21:35:17 -0300 Subject: [PATCH 2/2] apache-airflow: fix build on darwin - Disable failing test on darwin. - Patch failing test on Hydra (failed to write to /tmp) --- .../development/python-modules/apache-airflow/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/python-modules/apache-airflow/default.nix b/pkgs/development/python-modules/apache-airflow/default.nix index 23fa5b6a860d..22a1772bf162 100644 --- a/pkgs/development/python-modules/apache-airflow/default.nix +++ b/pkgs/development/python-modules/apache-airflow/default.nix @@ -199,6 +199,10 @@ buildPythonPackage rec { substituteInPlace tests/core/test_core.py \ --replace "/bin/bash" "${stdenv.shell}" + '' + lib.optionalString stdenv.isDarwin '' + # Fix failing test on Hydra + substituteInPlace airflow/utils/db.py \ + --replace "/tmp/sqlite_default.db" "$TMPDIR/sqlite_default.db" ''; # allow for gunicorn processes to have access to python packages @@ -220,6 +224,10 @@ buildPythonPackage rec { "tests/core/test_core.py" ]; + disabledTests = lib.optionals stdenv.isDarwin [ + "bash_operator_kill" # psutil.AccessDenied + ]; + postInstall = '' cp -rv ${airflow-frontend}/static/dist $out/lib/${python.libPrefix}/site-packages/airflow/www/static '';