-
Notifications
You must be signed in to change notification settings - Fork 1
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
helper tool? #7
Comments
@yarikoptic The first two items sound like tox (or its cousin nox) to me.... |
I think we should start (and forget about instantiating environments for now) with a helper
That would then allow us to run the tests within any specific environment (orchestrated outside, may be within/by testkraken or whatnot), and also add such testing to I guess we should somehow "reference" https://gin.g-node.org/dandi/nwb-healthstatus-samples which would get And later we decide on specification etc, and some other functionality would be just driving those commands in a given envrionment. |
ideally tests running should be done through some standard tests platform/runner, so I guess |
@yarikoptic Psuedocode for the architecture I was describing: class SampleCase(ABC):
#: Set of extensions needed by the sample case
EXTENSIONS: ClassVar[Set[str]]
#: Basename for the sample file created by the case
FILENAME: ClassVar[str]
@abstractmethod
def create(self, filepath: Path) -> None:
""" Creates a sample file at the given path """
...
@abstractmethod
def test(self, data: hdmf.container.Container) -> None:
""" Takes the data read from a sample file and asserts that it contains what it should """
...
def get_extension_cases(extensions: List[str]) -> List[Type[SampleCase]]:
""" Returns a list of all SampleCase classes that can be run with just the given extensions """
...
class Environment:
def get_extensions(self) -> List[str]:
""" Returns a list of the extensions in the environment """
...
def get_sample_directory(self, repo_base: Path) -> Path:
""" Determines the subpath of `repo_base` at which the sample files for this environment are stored """
... We then store the sample case classes in modules in a In def pytest_generate_tests(metafunc):
extensions = ### Get from metafunc.config
samples_dir = ### Get from metafunc.config
argvalues = []
ids = []
for casecls in get_extension_cases(extensions):
argvalues.append((casecls, samples_dir / casecls.FILENAME))
ids.append(casecls.FILENAME)
metafunc.parametrize("casecls,samplepath", argvalues, ids=ids)
def test_case(casecls, samplepath):
case = casecls()
with pynwb.NWBHDF5IO(samplepath, "r", load_namespaces=True) as io:
nwb = io.read()
case.test(nwb) The |
by an "extension" in the above you mean "nwb extensions"? and yeap -- I was thinking about similar "glob"ing of the available test cases, and thought just to compose |
List of actions we would need to perform and with which a helper tool could come handy
The text was updated successfully, but these errors were encountered: