From 270383026376d4db53e80e49ccfbda08719356ab Mon Sep 17 00:00:00 2001 From: Bas van Beek Date: Thu, 13 Jan 2022 12:20:28 +0100 Subject: [PATCH 1/3] DEP: Replace `pd.DataFrame.append` with `pd.concat` The `append` method is deprecated as of Pandas 1.4 --- dataCAT/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataCAT/functions.py b/dataCAT/functions.py index 682628e..20d032a 100644 --- a/dataCAT/functions.py +++ b/dataCAT/functions.py @@ -262,7 +262,7 @@ def even_index(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame: nan_row = get_nan_row(df1) idx = df2.index[~bool_ar] df_tmp = pd.DataFrame(len(idx) * [nan_row], index=idx, columns=df1.columns) - return df1.append(df_tmp, sort=True) + return pd.concat([df1, df_tmp], sort=True) def int_to_slice(int_like: SupportsIndex, seq_len: int) -> slice: From 68251195e891c0030affea09bb3d7d2f87d56ddf Mon Sep 17 00:00:00 2001 From: Bas van Beek Date: Thu, 13 Jan 2022 12:24:36 +0100 Subject: [PATCH 2/3] TST: Ignore `np.distutils` deprecation warnings --- setup.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.cfg b/setup.cfg index 3d6dfd3..9481a85 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,8 @@ ignore = W504 N806 testpaths = dataCAT tests addopts = --tb=short --doctest-glob='*.py' --doctest-glob='*.rst' --cov=dataCAT --cov-report xml --cov-report term --cov-report html --doctest-modules markers = slow: A marker for slow tests. +filterwarnings = + ignore::DeprecationWarning:numpy.distutils.* # Define `python setup.py build_sphinx` [build_sphinx] From e40a6b6587eeafd398952626e7a019a6418f523a Mon Sep 17 00:00:00 2001 From: Bas van Beek Date: Thu, 13 Jan 2022 12:27:10 +0100 Subject: [PATCH 3/3] TST: Use more pytest fixtures --- tests/test_database.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/test_database.py b/tests/test_database.py index 9f8843d..662cce3 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -4,7 +4,6 @@ import copy import shutil import pickle -import warnings from types import MappingProxyType from os.path import join, abspath from pathlib import Path @@ -12,6 +11,7 @@ import h5py import numpy as np import pandas as pd +import pytest from scm.plams import readpdb from nanoutils import delete_finally @@ -220,10 +220,7 @@ def test_update_hdf5_settinga() -> None: pass +@pytest.mark.skipif(DB.mongodb is None, reason="MongoDB server not found") def test_update_mbongodb() -> None: """Test :meth:`~dataCAT.Database.update_mbongodb`.""" - if DB.mongodb is None: - warnings.warn("MongoDB server not found; skipping test", category=RuntimeWarning) - return - DB.update_mongodb('ligand')