Skip to content
Snippets Groups Projects
Commit 18ee79cf authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

TST: fixed tests in test_json

parent 9fd8dcb8
No related branches found
No related tags found
1 merge request!96Draft: F refactor debug tree
......@@ -38,18 +38,20 @@ from caoscrawler.crawl import Crawler
from caoscrawler.structure_elements import File, JSONFile
from test_tool import rfp, dircheckstr
from caoscrawler.scanner import scan_structure_elements, load_definition, create_converter_registry
def test_json():
crawler_definition_path = rfp("test_directories", "examples_json",
"jsontest_cfood.yml")
json_file_path = rfp("test_directories", "examples_json", "testjson.json")
crawler = Crawler(debug=True)
crawler_definition = crawler.load_definition(crawler_definition_path)
crawler = Crawler()
crawler_definition = load_definition(crawler_definition_path)
# Load and register converter packages:
converter_registry = crawler.load_converters(crawler_definition)
converter_registry = create_converter_registry(crawler_definition)
records = crawler.start_crawling(
records, debug_tree = scan_structure_elements(
JSONFile(os.path.basename(json_file_path), json_file_path),
crawler_definition,
converter_registry
......@@ -72,6 +74,6 @@ def test_broken_validation():
"broken_cfoods", "broken_validation_path.yml")
crawler = Crawler()
with raises(FileNotFoundError) as err:
crawler_definition = crawler.load_definition(crawler_definition_path)
crawler_definition = load_definition(crawler_definition_path)
assert str(err.value).startswith("Couldn't find validation file")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment