Skip to content
Snippets Groups Projects
Commit ae87fa1e authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

TST: fix int test

parent 3d253fac
No related branches found
No related tags found
1 merge request!2ENH: Folder
......@@ -3,10 +3,16 @@
## Testing
Requires `bidsconverter` module: https://gitlab.indiscale.com/caosdb/src/crawler-converters/bids-converter
### Unit Tests
Run `pytest unittests`
### Integration Tests
After you started a server with the `test-profile` (see `integrationtests` folder)
you can run `pytest -x .` in `integrationtest`.
### Manual Tests
You can crawl examples from the `bids-examples` submodule:
## Usage
You will need to copy the cfood definition `./src/bids-cfood/dataset_description_cfood.yml`
You will need to copy (parts of) the cfood definition `./src/bids-cfood/cfood.yml`
into your cfood.
......@@ -21,7 +21,8 @@ default:
# extroot: From where files are copied/symlinked. This is a
# list of `NAME: PATH` pairs or a single path.
extroot:
"": "../../bids-examples/"
"examples": "../../bids-examples/"
"valid_dataset": "../../unittests/test_data/valid_dataset/"
#
# "base": "/path/to/base/dir"
# "other": "/path/to/other"
......
......@@ -23,6 +23,7 @@
import sys
import json
import logging
import pytest
import os
......@@ -65,14 +66,15 @@ def test_folders(clear_database, usemodel):
# Load and register converter packages:
converter_registry = crawler.load_converters(crawler_definition)
# print("DictIntegerElement" in converter_registry)
logger = logging.getLogger("caoscrawler")
logger.setLevel(logging.DEBUG)
records = crawler.start_crawling(
Directory('valid_dataset', rfp("../unittests/test_data/valid_dataset")),
crawler_definition,
converter_registry
)
crawler.save_debug_data("prov.yml")
files = [fi for fi in records if isinstance(fi, db.File)]
for fi in files:
fi.file = __file__
......@@ -88,5 +90,5 @@ def test_folders(clear_database, usemodel):
assert len(funcs) == 30
assert len(anats) == 10
for el in funcs:
assert (len(el.get_property("RawData").value) == 2
or len(el.get_property("RawData").value) == 3)
assert (len(el.get_property("FunctionalImagingDataFile").value) == 2
or len(el.get_property("FunctionalImagingDataFile").value) == 3)
......@@ -92,7 +92,7 @@ metadata:
definition:
${parent}_datafile:
type: SimpleFile
debug_match: True
debug_match: False
match: ^sub-(?P<sub>[a-zA-Z0-9]+)(_ses-(?P<ses>[a-zA-Z0-9]+))?((_task-(?P<task>[a-zA-Z0-9]+))|(_acq-(?P<acq>[a-zA-Z0-9]+))|(_run-(?P<run>[a-zA-Z0-9]+))|(_space-(?P<space>[a-zA-Z0-9]+))|(_recording-(?P<recording>[a-zA-Z0-9]+)))*(_(?P<suffix>${suffix}))?\.(?P<extension>[.a-zA-Z0-9]+)$
records:
someFile:
......@@ -384,7 +384,7 @@ project_level:
Subject:
Session: +$Session
subtree:
func:
func:
type: BIDSFUNCDirectory
match: ^(?P<datatype>func)$
subtree:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment