diff --git a/erroranalysis/requirements-dev.txt b/erroranalysis/requirements-dev.txt index 7b6ac5bc30..7d3453a0c1 100644 --- a/erroranalysis/requirements-dev.txt +++ b/erroranalysis/requirements-dev.txt @@ -1,6 +1,6 @@ -pytest==5.0.1 +pytest==7.0.1 pytest-cov -pytest-mock==3.1.1 +pytest-mock==3.6.1 requests==2.25.1 requirements-parser==0.2.0 diff --git a/rai_core_flask/requirements-dev.txt b/rai_core_flask/requirements-dev.txt index a63aebcd42..5c120558c9 100644 --- a/rai_core_flask/requirements-dev.txt +++ b/rai_core_flask/requirements-dev.txt @@ -1,6 +1,6 @@ -pytest==5.0.1 +pytest==7.0.1 pytest-cov -pytest-mock==3.1.1 +pytest-mock==3.6.1 requests==2.25.1 requirements-parser==0.2.0 diff --git a/raiutils/requirements-dev.txt b/raiutils/requirements-dev.txt index 5ad743dbe0..14741a0cfd 100644 --- a/raiutils/requirements-dev.txt +++ b/raiutils/requirements-dev.txt @@ -1,6 +1,6 @@ -pytest==5.0.1 +pytest==7.0.1 pytest-cov -pytest-mock==3.1.1 +pytest-mock==3.6.1 requests==2.25.1 requirements-parser==0.2.0 diff --git a/raiwidgets/requirements-dev.txt b/raiwidgets/requirements-dev.txt index a23c8e9f18..c125631603 100644 --- a/raiwidgets/requirements-dev.txt +++ b/raiwidgets/requirements-dev.txt @@ -1,9 +1,8 @@ # Requirements for raiwidgets development -pytest==5.0.1 -mock==4.0.1 +pytest==7.0.1 pytest-cov -pytest-mock==3.1.1 +pytest-mock==3.6.1 requests==2.25.1 requirements-parser==0.2.0 diff --git a/raiwidgets/tests/test_fairness_calculations.py b/raiwidgets/tests/test_fairness_calculations.py index 49f417f2d2..6c468115c2 100644 --- a/raiwidgets/tests/test_fairness_calculations.py +++ b/raiwidgets/tests/test_fairness_calculations.py @@ -3,6 +3,7 @@ import numpy as np import pytest +from pytest import approx from raiwidgets.fairness_metric_calculation import (compute_wilson_bounds, false_negative_rate_wilson, @@ -58,23 +59,23 @@ def test_false_negative_rate_wilson(sample_binary_data): def test_mse_standard_normal_binary(sample_binary_data): y_true, y_pred = sample_binary_data - assert pytest.approx(mse_standard_normal(y_true, y_pred), (0.0160, 0.5840)) + mse = mse_standard_normal(y_true, y_pred) + assert mse == approx((0.0160, 0.5840), rel=1e-3, abs=1e-3) def test_mae_standard_normal_binary(sample_binary_data): y_true, y_pred = sample_binary_data - assert pytest.approx(mae_standard_normal(y_true, y_pred), (0.0160, 0.5840)) + mae = mae_standard_normal(y_true, y_pred) + assert mae == approx((0.0160, 0.5840), rel=1e-3, abs=1e-3) def test_mse_standard_normal_continuous(sample_continuous_data): y_true, y_pred = sample_continuous_data - assert pytest.approx( - mse_standard_normal(y_true, y_pred), (57.7926, 637.2074) - ) + mse = mse_standard_normal(y_true, y_pred) + assert mse == approx((57.7926, 637.2074), rel=1e-3, abs=1e-3) def test_mae_standard_normal_continuous(sample_continuous_data): y_true, y_pred = sample_continuous_data - assert pytest.approx( - mae_standard_normal(y_true, y_pred), (9.4708, 21.9292) - ) + mae = mae_standard_normal(y_true, y_pred) + assert mae == approx((9.4708, 21.9292), rel=1e-3, abs=1e-3) diff --git a/raiwidgets/tests/test_no_fairlearn.py b/raiwidgets/tests/test_no_fairlearn.py index e7bc25a883..aa61f3bda9 100644 --- a/raiwidgets/tests/test_no_fairlearn.py +++ b/raiwidgets/tests/test_no_fairlearn.py @@ -1,7 +1,8 @@ # Copyright (c) Microsoft Corporation # Licensed under the MIT License. -import mock +from unittest.mock import patch + import pytest from raiwidgets import FairnessDashboard @@ -9,7 +10,7 @@ MODULE_NOT_INSTALLED_ERROR_MESSAGE -@mock.patch("importlib.import_module") +@patch("importlib.import_module") def test_no_fairlearn(importlib_mock): importlib_mock.side_effect = \ ModuleNotFoundError("No module named 'fairlearn.metrics'") diff --git a/raiwidgets/tests/test_responsibleai_dashboard_input.py b/raiwidgets/tests/test_responsibleai_dashboard_input.py index 27627c8849..0d16e36b4a 100644 --- a/raiwidgets/tests/test_responsibleai_dashboard_input.py +++ b/raiwidgets/tests/test_responsibleai_dashboard_input.py @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation # Licensed under the MIT License. -import mock +from unittest.mock import patch from raiwidgets.responsibleai_dashboard_input import \ ResponsibleAIDashboardInput @@ -15,7 +15,7 @@ def test_model_analysis_adult( test_data = ri.test dashboard_input = ResponsibleAIDashboardInput(ri) - with mock.patch.object(knn, "predict_proba") as predict_mock: + with patch.object(knn, "predict_proba") as predict_mock: test_pred_data = test_data.head(1).drop("Income", axis=1).values dashboard_input.on_predict( test_pred_data) diff --git a/responsibleai/requirements-dev.txt b/responsibleai/requirements-dev.txt index afbdada9fc..f2ef5f15dc 100644 --- a/responsibleai/requirements-dev.txt +++ b/responsibleai/requirements-dev.txt @@ -1,9 +1,8 @@ # Requirements for responsibleai development -pytest==5.0.1 +pytest==7.0.1 pytest-cov -mock==4.0.1 -pytest-mock==3.1.1 +pytest-mock==3.6.1 # Required for responsibleai package tests deptree~=0.0.10