Skip to content
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

Libervia-backend #87

Closed
augustebaum opened this issue Oct 30, 2023 · 5 comments · Fixed by #325
Closed

Libervia-backend #87

augustebaum opened this issue Oct 30, 2023 · 5 comments · Fixed by #325
Assignees
Labels
NGI0 Review Funded through NGI Zero Review

Comments

@augustebaum
Copy link
Contributor

Source code: https://repos.goffi.org/libervia-backend/

Part of #4

@augustebaum augustebaum added the NGI0 Review Funded through NGI Zero Review label Oct 30, 2023
@alejandrosame
Copy link
Contributor

@goffi-contrib: while running test for libervia-backend we get the following error:

�[1m============================= test session starts ==============================�[0m
platform linux -- Python 3.10.12, pytest-7.4.0, pluggy-1.2.0
rootdir: /build/hg-archive
�[1mcollecting ... �[0m�[1m
collected 0 items / 1 error                                                    �[0m

==================================== ERRORS ====================================
�[31m�[1m________________________ ERROR collecting test session _________________________�[0m
...
�[1m�[31mtests/e2e/conftest.py�[0m:29: in <module>
    from sh import li
�[1m�[31mE   ImportError: cannot import name 'li' from 'sh' (/nix/store/4mk9i1wbxxyixglf87smv0v14yz0389p-python3.10-sh-2.0.2/lib/python3.10/site-packages/sh.py)�[0m
�[36m�[1m=========================== short test summary info ============================�[0m
�[31mERROR�[0m  - ImportError: cannot import name 'li' from 'sh' (/nix/store/4mk9i1wbxxyixglf...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
�[31m=============================== �[31m�[1m1 error�[0m�[31m in 0.18s�[0m�[31m ===============================�[0m
/nix/store/3pfjacvdg9f491lfqc9qb2d0nknx73fb-stdenv-linux/setup: line 1596: pop_var_context: head of shell_variables not a function context

The sh we are pulling from is https://pypi.org/project/sh/ at version 2.0.2, which doesn't seem a compatible package/version.

Which sh library should we use to make this test work?

@jfly
Copy link
Contributor

jfly commented Oct 30, 2023

@alejandrosame, sh works via magic, if you do something like from sh import foo, it'll expect to find a foo binary somewhere on your PATH. The way to interpret this error is that the tests expect there to be a li binary somewhere on your PATH, and there isn't. It looks like that li binary is provided by libervia-backend itself, see its pyproject.toml here.

@augustebaum
Copy link
Contributor Author

Woah, black magic indeed. Thanks!

@goffi-contrib
Copy link

Hello,

those tests using sh are the end-to-end tests, they need to be launched with the run_e2e.py. It is documented at https://libervia.org/__b/doc/backend/contributing/testing.html . They use docker images and mount the source inside the containers, there is normally nothing to install for them. However due to big architectural changes recently, they are currently broken, I'll fix them soon (I mostly need to update the docker images in /docker, this will also fix the local demo image).

Beside that, the tests in tests/unit are unit tests and can be run directly with pytest as long as you have a dev env installed.

I've moved recently to Hatch, and to run the dev env, you can use hatch -e dev shell. However, I realize the the pytest modules are currently missing in my pyproject.toml, I'll fix that soon too.

Sorry for the temporarily broken things, it's a huge project, and it's difficult to keep everything running immediately when I'm doing big structural changes.

@augustebaum augustebaum mentioned this issue Oct 31, 2023
@augustebaum
Copy link
Contributor Author

augustebaum commented Oct 31, 2023

Closed for now, see #4 (comment)

As of writing this the most recent work on this project can be found at the libervia-backend branch. Current diff with main: 7b928f2...30c6927.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NGI0 Review Funded through NGI Zero Review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants