Skip to content

Commit

Permalink
Eliminate pytest warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pvandyken committed May 1, 2024
1 parent 4f352c1 commit 16d032e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ cmd = """
[tool.pytest.ini_options]
markers = [
"docker: marks tests as requiring docker (deselect with '-m \"not docker\"')",
"disable_fakefs: disable the fake filesystem in a hypothesis test"
]

[tool.coverage.run]
Expand Down
4 changes: 3 additions & 1 deletion snakebids/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
from hypothesis import HealthCheck, example, settings
from typing_extensions import ParamSpec

from snakebids import bids
from snakebids import bids_factory
from snakebids.core.datasets import BidsDataset
from snakebids.core.input_generation import generate_inputs
from snakebids.paths import specs
from snakebids.types import InputsConfig, ZipList, ZipListLike
from snakebids.utils.containers import MultiSelectDict, UserDictPy38
from snakebids.utils.utils import BidsEntity
Expand Down Expand Up @@ -103,6 +104,7 @@ def get_bids_path(entities: Iterable[str | BidsEntity], **extras: str) -> str:
def get_tag(entity: BidsEntity) -> tuple[str, str]:
return entity.wildcard, f"{{{entity.wildcard}}}"

bids = bids_factory(specs.latest())
return bids(
**dict(get_tag(BidsEntity(entity)) for entity in sorted(entities)),
**{BidsEntity(entity).wildcard: value for entity, value in extras.items()},
Expand Down
26 changes: 17 additions & 9 deletions snakebids/tests/test_generate_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,23 @@ def test_second_return_never_none(
pybidsdb_reset: bool | None,
pybids_database_reset: bool | None,
):
assert (
_normalize_database_args(
None,
pybidsdb_reset,
None,
pybids_database_reset,
)[1]
is not None
)
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message=r"The parameter `pybids_reset_database` in generate_inputs\(\) "
"is deprecated and will be removed in the next release. To reset the "
"pybids database, use the `pybidsdb_reset` parameter instead",
category=UserWarning,
)
assert (
_normalize_database_args(
None,
pybidsdb_reset,
None,
pybids_database_reset,
)[1]
is not None
)

@given(pybidsdb_dir=st.text().filter(_not_deprecated))
def test_deprecated_dir_raises_warning(self, pybidsdb_dir: str):
Expand Down

0 comments on commit 16d032e

Please sign in to comment.