Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FutureWarning instead of DeprecationWarning. #692

Merged
merged 14 commits into from
Mar 12, 2022
2 changes: 1 addition & 1 deletion signac/contrib/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def __init__(self, *args, **kwargs):
warnings.warn(
"The MasterCrawler class has been replaced by the MainCrawler class. "
"Both classes are deprecated and will be removed in a future release.",
DeprecationWarning,
FutureWarning,
)
super().__init__(*args, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions signac/synced_collections/backends/collection_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _str_key(key):
warnings.warn(
f"Use of {type(key).__name__} as key is deprecated "
"and will be removed in version 2.0",
DeprecationWarning,
FutureWarning,
)
key = str(key)
return key
Expand Down Expand Up @@ -146,7 +146,7 @@ def json_attr_dict_validator(data):
warnings.warn(
f"Use of {type(key).__name__} as key is deprecated "
"and will be removed in version 2.0.",
DeprecationWarning,
FutureWarning,
)
data[str(key)] = data.pop(key)
else:
Expand Down
8 changes: 4 additions & 4 deletions signac/synced_collections/buffers/file_buffered_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ def buffer_backend(cls, buffer_size=None, force_write=None, *args, **kwargs):
"""
if force_write is not None:
warnings.warn(
DeprecationWarning(
"The force_write parameter is deprecated and will be removed in "
"signac 2.0. This functionality is no longer supported."
)
"The force_write parameter is deprecated and will be removed in "
"signac 2.0. This functionality is no longer supported.",
FutureWarning,
)

return cls._buffer_context(buffer_size)
13 changes: 0 additions & 13 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
import uuid
from contextlib import contextmanager

import pytest
from packaging import version

import signac


@contextmanager
def deprecated_in_version(version_string):
if version.parse(version_string) <= version.parse(signac.__version__):
with pytest.deprecated_call():
yield
else:
yield


@pytest.fixture
Expand Down
3 changes: 1 addition & 2 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import pytest
import test_h5store
from conftest import deprecated_in_version
from packaging import version
from test_job import TestJobBase

Expand Down Expand Up @@ -1099,7 +1098,7 @@ def test_temp_project(self):
assert not os.path.isdir(tmp_root_dir)

def test_access_module(self):
with deprecated_in_version("1.5"):
with pytest.deprecated_call():
self.project.create_access_module()


Expand Down
2 changes: 1 addition & 1 deletion tests/test_synced_collections/test_json_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TestJSONDict(JSONCollectionTest, SyncedDictTest):
# See issue: https://github.com/glotzerlab/signac/issues/316.
def test_keys_non_str_valid_type(self, synced_collection, testdata):
for key in (0, None, True):
with pytest.deprecated_call(match="Use of.+as key is deprecated"):
with pytest.warns(FutureWarning, match="Use of.+as key is deprecated"):
synced_collection[key] = testdata
assert str(key) in synced_collection
assert synced_collection[str(key)] == testdata
Expand Down