Skip to content

Commit

Permalink
Suppress warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Chulock <[email protected]>
  • Loading branch information
jason-recurve committed Jan 28, 2025
1 parent a1298dd commit ddf1060
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
14 changes: 8 additions & 6 deletions eemeter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
import platform
import warnings

if platform.processor() == "arm":
# these happen during native code execution and segfault pytest when filterwarnings is set to error
warnings.filterwarnings("ignore", module="importlib._bootstrap")
warnings.filterwarnings(
"ignore", "builtin type swigvarlink has no __module__ attribute"
)
# these happen during native code execution and segfault pytest when filterwarnings is set to error
warnings.filterwarnings("ignore", module="importlib._bootstrap")
warnings.filterwarnings(
"ignore", "builtin type swigvarlink has no __module__ attribute"
)
warnings.filterwarnings(
"ignore", "builtin type SwigPyPacked has no __module__ attribute"
)

if platform.system() == "Windows":
# numba JIT breaks on Windows with int32/int64 return types
Expand Down
3 changes: 2 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ addopts =
-vv

filterwarnings =
; error
error
# the above filter is useful to debug and fix warnings locally, but
# frequently causes segfaults during CI when native code is running.
# perhaps we can add a secondary step that fails if warnings are present

# suppressed warnings
default:Level value of 5 is too high
ignore:builtin type swigvarlink has no __module__ attribute
ignore:builtin type SwigPyObject has no __module__ attribute

#TODO breaks after sklearn 1.7 releases
default:`BaseEstimator._validate_data` is deprecated in 1.6
1 change: 1 addition & 0 deletions tests/test_hourly_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def test_hourly_fit_daily_threshold(baseline):
assert b2.loc["2018-01-08", "include_date"].sum() == 0
assert b2.loc["2018-01-09", "include_date"].sum() == 24

@pytest.mark.filterwarnings("ignore:Objective did not converge.")
def test_hourly_error_metric_dq(baseline):
baseline["observed"] = np.random.normal(-1, 10, len(baseline)) ** 3
baseline_data = HourlyBaselineData(baseline, is_electricity_data=True)
Expand Down

0 comments on commit ddf1060

Please sign in to comment.