Open augustebaum opened 1 year ago
@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?
@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.
Woah, black magic indeed. Thanks!
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.
Closed for now, see https://github.com/ngi-nix/ngipkgs/issues/4#issuecomment-1786916017
As of writing this the most recent work on this project can be found at the libervia-backend
branch. Current diff with main
: https://github.com/ngi-nix/ngipkgs/compare/7b928f2b92e55c4bcd4d218118c5f17d561f4364...30c69276c87349011f1209d711864528e62970f3.
Source code: https://repos.goffi.org/libervia-backend/
Part of #4