-
Notifications
You must be signed in to change notification settings - Fork 192
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
Fixtures: Add aiida_computer_localhost
and aiida_computer_ssh
#5786
Fixtures: Add aiida_computer_localhost
and aiida_computer_ssh
#5786
Conversation
aiida_computer_localhost
and aiida_computer_ssh
These fixtures are required for #5787 . Once this is approved and merged, I will go through the unit tests and clean them up, using the fixtures instead of test manually constructing computers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot @sphuber !
here a few comments from a quick review
66fb394
to
286804a
Compare
This is a convenience property that calls `is_user_configured` but automatically passed the current default user.
These fixtures return an instance of `Computer` that represents the localhost computer with `core.local` and `core.ssh` as the transport type, respectively. By default, the computers are also configured. The `aiida_computer_ssh` will even create an SSH key pair automatically for the session such that the SSH transport can actually be opened. The fixtures both call the more generic `aiida_computer` which returns a factory that gives greater control on how the computer is created and configured. Usuallly the two wrappers are all that is needed for the majority of tests. The fixtures are placed in `pytest_fixtures` instead of the `conftest.py` of `aiida-core`, because `aiida_computer` and `aiida_computer_local` should be available to plugins. The `aiida_computer_ssh` is probably mostly useful for tests in `aiida-core`, but for clarity it is kept together with `aiida_computer_local`. The existing fixture `aiida_localhost` now simply uses the `aiida_computer_local` fixture as the implementation.
286804a
to
5d3c55a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot @sphuber !
looks good to me
Cheers @ltalirz 👍 |
These fixtures return an instance of
Computer
that represents thelocalhost computer with
core.local
andcore.ssh
as the transporttype, respectively. By default, the computers are also configured. The
aiida_computer_ssh
will even create an SSH key pair automatically forthe session such that the SSH transport can actually be opened.
The fixtures both call the more generic
aiida_computer
which returns afactory that gives greater control on how the computer is created and
configured. Usuallly the two wrappers are all that is needed for the
majority of tests.
The fixtures are placed in
pytest_fixtures
instead of theconftest.py
of
aiida-core
, becauseaiida_computer
andaiida_computer_localhost
should be available to plugins. The
aiida_computer_ssh
is probablymostly useful for tests in
aiida-core
, but for clarity it is kepttogether with
aiida_computer_localhost
.These new fixtures provide the same functionality as
aiida_localhost
but are more flexible. The
aiida_localhost
fixture is thereforedeprecated.