The idea is that all information is generated using `things/v2+` features only. This would make this tool compatible with any `things`-derived schema, and not specific to something like `research-information`. The adaptation to a specific, derived schema could then be implemented by a generic (not BIDS-specific) tool that looks for information in a record that can be expressed (more natively) using predefined structural slots of a concrete class in a derived schema.
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
"""Collection of fixtures for facilitation test implementations"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from shutil import which
|
|
|
|
import pytest
|
|
|
|
|
|
def _which_cmd(cmd: str) -> str:
|
|
binary = which(cmd)
|
|
if not binary:
|
|
pytest.skip(f'`{cmd}` is not available.')
|
|
# we cannot get here, but return a str to satisfy
|
|
# the type-checker
|
|
return ''
|
|
return binary
|
|
|
|
|
|
# function-scope to be able to skip each "calling" test
|
|
@pytest.fixture(autouse=False, scope='function') # noqa: PT003
|
|
def cat_util() -> list[str]:
|
|
"""Returns command(args) list of a `cat` utility
|
|
|
|
Skips the underlying test if no `cat` is available.
|
|
|
|
In the future, this fixture may provide a Python-based
|
|
`cat` replacement for testing purposed.
|
|
"""
|
|
return [_which_cmd('cat')]
|
|
|
|
|
|
# function-scope to be able to skip each "calling" test
|
|
@pytest.fixture(autouse=False, scope='function') # noqa: PT003
|
|
def ls_util() -> list[str]:
|
|
"""Returns command(args) list of a `ls` utility
|
|
|
|
Skips the underlying test if no `ls` is available.
|
|
"""
|
|
return [_which_cmd('ls')]
|
|
|
|
|
|
# function-scope to be able to skip each "calling" test
|
|
@pytest.fixture(autouse=False, scope='function') # noqa: PT003
|
|
def funzip_util() -> list[str]:
|
|
"""Returns command(args) list of a `funzip` utility
|
|
|
|
Skips the underlying test if no `funzip` is available.
|
|
"""
|
|
return [_which_cmd('funzip')]
|