Skip to content

Commit

Permalink
upgrade pytest to 7.0.1, remove mock and updgrade pytest-mock to 3.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
imatiach-msft committed Mar 23, 2022
1 parent 70895df commit 2e2f767
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions erroranalysis/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions rai_core_flask/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions raiutils/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions raiwidgets/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 9 additions & 8 deletions raiwidgets/tests/test_fairness_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
5 changes: 3 additions & 2 deletions raiwidgets/tests/test_no_fairlearn.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Copyright (c) Microsoft Corporation
# Licensed under the MIT License.

import mock
from unittest.mock import patch

import pytest

from raiwidgets import FairnessDashboard
from raiwidgets.fairness_metric_calculation import \
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'")
Expand Down
4 changes: 2 additions & 2 deletions raiwidgets/tests/test_responsibleai_dashboard_input.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions responsibleai/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2e2f767

Please sign in to comment.