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

Raise errors for uncaught FutureWarnings / DeprecationWarnings in signac. #713

Merged
merged 5 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ omit =

[tool:pytest]
filterwarnings =
ignore: .*[The indexing module | get_statepoint | Use of.+as key] is deprecated.*: DeprecationWarning
error::FutureWarning:signac.*
error::DeprecationWarning:signac.*
ignore:Project names are deprecated:FutureWarning
ignore:Modifying the project configuration:FutureWarning
ignore:.+The indexing module is deprecated:FutureWarning
ignore:get_statepoint is deprecated:FutureWarning
ignore:Use of .+ as key is deprecated:FutureWarning
ignore:SimpleKeyring is deprecated:FutureWarning
ignore:The doc_filter argument was deprecated:FutureWarning
ignore:Calling next\(\) directly on a JobsCursor is deprecated:FutureWarning
ignore:groupbydoc is deprecated:FutureWarning
ignore:The index argument is deprecated:FutureWarning
ignore:copytree is deprecated:FutureWarning
ignore:dumps is deprecated:FutureWarning

[bumpversion:file:setup.py]

Expand Down
25 changes: 14 additions & 11 deletions tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os
import random
import uuid
import warnings
from contextlib import contextmanager
from tempfile import TemporaryDirectory

Expand Down Expand Up @@ -78,8 +77,6 @@ def setUp(self, request):
name="testing_test_project", root=self._tmp_pr, workspace=self._tmp_wd
)

warnings.filterwarnings("ignore", category=DeprecationWarning, module="signac")

def tearDown(self):
pass

Expand Down Expand Up @@ -438,13 +435,16 @@ def test_interface_multiple_changes(self):
def test_valid_sp_key_types(self):
job = self.open_job(dict(invalid_key=True)).init()

class A:
pass

for key in ("0", 0, True, False, None):
for key in ("0",):
job.sp[key] = "test"
assert str(key) in job.sp

# TODO: Non-string keys will not be supported in signac 2.0.
for key in (0, True, False, None):
with pytest.warns(FutureWarning):
job.sp[key] = "test"
assert str(key) in job.sp

def test_invalid_sp_key_types(self):
class A:
pass
Expand All @@ -468,13 +468,16 @@ class A:
def test_valid_doc_key_types(self):
job = self.open_job(dict(invalid_key=True)).init()

class A:
pass

for key in ("0", 0, True, False, None):
for key in ("0",):
job.doc[key] = "test"
assert str(key) in job.doc

# TODO: Non-string keys will not be supported in signac 2.0.
for key in (0, True, False, None):
with pytest.warns(FutureWarning):
job.doc[key] = "test"
assert str(key) in job.doc

def test_invalid_doc_key_types(self):
job = self.open_job(dict(invalid_key=True)).init()

Expand Down
1 change: 1 addition & 0 deletions tests/test_jsondict.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def setUp(self, request):
self._fn_dict = os.path.join(self._tmp_dir.name, FN_DICT)


@pytest.mark.filterwarnings("ignore::FutureWarning")
class TestJSONDict(TestJSONDictBase):
def get_json_dict(self):
return JSONDict(filename=self._fn_dict)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import string
import sys
import uuid
import warnings
from contextlib import contextmanager, redirect_stderr
from tarfile import TarFile
from tempfile import TemporaryDirectory
Expand Down Expand Up @@ -2594,7 +2593,6 @@ def setUp_base_h5Store(self, request):
name="testing_test_project", root=self._tmp_pr, workspace=self._tmp_wd
)

warnings.filterwarnings("ignore", category=DeprecationWarning, module="signac")
self._fn_store = os.path.join(self._tmp_dir.name, "signac_data.h5")
self._fn_store_other = os.path.join(self._tmp_dir.name, "other.h5")

Expand Down
1 change: 1 addition & 0 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def test_create_doc_dict_with_error_dryrun(self):
assert len(self.doc) == 0


@pytest.mark.filterwarnings("ignore::FutureWarning")
class TestFileModifyProxyJSONDocBackup(TestFileModifyProxyDocBackup):
@pytest.fixture(autouse=True)
def setUp(self, request):
Expand Down
1 change: 1 addition & 0 deletions tests/test_synced_attrdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def save(self):
self._saved += 1


@pytest.mark.filterwarnings("ignore::FutureWarning")
class TestSyncedAttrDict:
@pytest.fixture(autouse=True)
def setUp(self):
Expand Down