As reported initially by Thomas Goirand in Debian Bug#1015011, the test suite of bmtk fails with the error message below when the version of the Python module jsonschema is bumped to version 4:
--- Logging error ---
Traceback (most recent call last):
File "/<<PKGBUILDDIR>>/bmtk/simulator/core/simulation_config.py", line 67, in validate
return super(SimulationConfig, self).validate()
File "/<<PKGBUILDDIR>>/bmtk/utils/sonata/config/sonata_config.py", line 145, in validate
self.validator.validate(self)
File "/<<PKGBUILDDIR>>/bmtk/simulator/core/simulation_config.py", line 61, in validator
self._validator = SimulationConfigValidator(schema=config_schema)
File "/<<PKGBUILDDIR>>/bmtk/simulator/core/simulation_config_validator.py", line 41, in __init__
super(SimulationConfigValidator, self).__init__(schema, types, resolver, format_checker)
TypeError: create.<locals>.Validator.__init__() takes from 2 to 4 positional arguments but 5 were given
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/logging/__init__.py", line 1103, in emit
stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/pytest/__main__.py", line 5, in <module>
raise SystemExit(pytest.console_main())
File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 187, in console_main
code = main()
File "/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 164, in main
ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 315, in pytest_cmdline_main
return wrap_session(config, _main)
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 268, in wrap_session
session.exitstatus = doit(config, session) or 0
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 322, in _main
config.hook.pytest_runtestloop(session=session)
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/python3/dist-packages/_pytest/main.py", line 347, in pytest_runtestloop
item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 111, in pytest_runtest_protocol
runtestprotocol(item, nextitem=nextitem)
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 130, in runtestprotocol
reports.append(call_and_report(item, "call", log))
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 219, in call_and_report
call = call_runtest_hook(item, when, **kwds)
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 258, in call_runtest_hook
return CallInfo.from_call(
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 338, in from_call
result: Optional[TResult] = func()
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 259, in <lambda>
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/python3/dist-packages/_pytest/runner.py", line 166, in pytest_runtest_call
item.runtest()
File "/usr/lib/python3/dist-packages/_pytest/python.py", line 1761, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/usr/lib/python3/dist-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/usr/lib/python3/dist-packages/_pytest/python.py", line 192, in pytest_pyfunc_call
result = testfunction(**testargs)
File "/<<PKGBUILDDIR>>/bmtk/tests/simulator/core/test_simulation_config_validator.py", line 23, in test_validate_network
assert(cfg.validate())
File "/<<PKGBUILDDIR>>/bmtk/simulator/core/simulation_config.py", line 71, in validate
self.io.log_exception(msg)
File "/<<PKGBUILDDIR>>/bmtk/simulator/core/io_tools.py", line 122, in log_exception
self.logger.error(message)
Message: 'SimulationConfig ValidationError: create.<locals>.Validator.__init__() takes from 2 to 4 positional arguments but 5 were given'
Arguments: ()
This has been tested with python3 3.9.13 and 3.10.5. Affected jsonschema module version is 4.6.0, the former 3.2.0 is the last know version to not raise that issue. To reproduce the issue, simply run the test suite:
$ python3 -m pytest bmtk/tests/
The patch below seems to at least work around the problem:
When strolling through the jsonschema source code, I stumbled upon a statement that a _defaulttypes parameter was deprecated in version 3 and _typechecker should be prefered; _defaulttypes has then been removed in version 4, so maybe this is relevant?
Greetings,
As reported initially by Thomas Goirand in Debian Bug#1015011, the test suite of bmtk fails with the error message below when the version of the Python module jsonschema is bumped to version 4:
This has been tested with python3 3.9.13 and 3.10.5. Affected jsonschema module version is 4.6.0, the former 3.2.0 is the last know version to not raise that issue. To reproduce the issue, simply run the test suite:
The patch below seems to at least work around the problem:
When strolling through the jsonschema source code, I stumbled upon a statement that a _defaulttypes parameter was deprecated in version 3 and _typechecker should be prefered; _defaulttypes has then been removed in version 4, so maybe this is relevant?
Have a nice day, :)\ Étienne.