Extend test suite to run more tests also in pre-commit#3702
Extend test suite to run more tests also in pre-commit#3702
Conversation
heplesser
left a comment
There was a problem hiding this comment.
@terhorstd Thanks for this PR. Unfortunately, it comes with several changes that I believe hurt code readability, that I do not understand and that break the testsuite.
Concerning code formatting for C++, I think the changes to for-loop header indentation reduces readability. Even worse is the the line break after :: in many method declarations. Here, we need to stick to the old style.
I also do not understand why all tests suddenly are converted to importable Python packages. As far as I understand the Pytest documentation, when keeping tests outside the installable package as we do, tests should not be packages (https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#tests-outside-application-code).
All tests currently fail because connect_test_base.py is not found when tests try to import it.
| comm.gather(nest.serialize_data(response), root=0) | ||
| def main(): | ||
| opt = docopt(__doc__) | ||
| if rank == 0: |
There was a problem hiding this comment.
Here, rank is a global variable, is it not? Can we avoid that, maybe by restructuring the code?
| nest.server.run_mpi_app(host=opt.get("--host", HOST), port=opt.get("--port", PORT)) | ||
|
|
||
| else: | ||
| logger.info(f"==> Starting NEST Server Worker on rank {rank}") |
There was a problem hiding this comment.
The else block is very large. Could one restructure the code to avoid such a long else block? Maybe return at the end of the if block?
| template < int D, class T > | ||
| Position< D, T >::operator std::string() const | ||
| Position< D, T >:: | ||
| operator std::string() const |
There was a problem hiding this comment.
This reformatting looks very strange to me, significantly reducing code readability. Can we keep the old form and get the formatter to understand that this should be one line? Breaking on :: seems really weird to me.
| i != thread_local_wfr_nodes.end(); | ||
| ++i ) |
There was a problem hiding this comment.
I do not like this change. I think the loop is more readable if all parts are aligned under each other as in the old version here. Can we not keep the old rules?
Co-authored-by: Hans Ekkehard Plesser <hans.ekkehard.plesser@nmbu.no>
The test framework uses some outdated versions that start to become difficult with newer python versions. The main change in this PR is the update of some
pyproject.tomlsections and the.pre-commit-config.yaml. New checks are added to improve developer-local checks as well as the CI side.In more detail:
mypy.iniwas translated topyproject.tomlto have config in one placenest-servercode was slightly refactored to meet absolute minimum quality requirements.from . import connect_test_baseto be checked. (which is subsequently resorted by isort)n_events: int = spike_recorder.get("n_events")mpi/2/*.py→mpi/nproc2/*.pyshellcheck