-
Notifications
You must be signed in to change notification settings - Fork 54
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
Reform pythontests nixshell #391
base: master
Are you sure you want to change the base?
Conversation
* nix-shell: Added variation that doesnt run the tests. * nix-shell: Explicit use of same version of rust than rust-toolchain. * nix-shell: Added poe. * prepare.sh now executes "poetry install --no-root" to set tests dependencies. * floresta_cli_getrpcinfo.py now is path agnostic without its assertion on path tree.
ee2153e
to
04eec95
Compare
9fe57bb
to
ef46a8d
Compare
# Same as `test-int-nixsetup` but execute the tests and exits | ||
test-int-nixrun: | ||
nix develop .#pythonTests -c bash -c "bash ./tests/run.sh" | ||
|
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.
@nyonson
instead of a raw call of "poetry run poe tests" i followed the same approach than CI.
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.
run.sh
just manipulates $PATH
to expose the correct binary for python and, after running all tests, restores $PATH
, of course.
its intrusive but works fine.
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.
Are there isolation benefits to the double bash wrapping? Can we just make run.sh executable and call it directly or are you trying to avoid that given the PATH manipulation?
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.
I hadn't thought of that... its just a weird habit that i have to avoid getting yelled by the terminal when i forget the shebang.
Since its already isolated by nix its safe to manipulate things there... Ill just change #!/bin/bash
to #!/bin/sh
# PR #331 introduced a preparatory environment at | ||
# /tmp/floresta-integration-tests.$(git rev-parse HEAD). | ||
tmpdir = FlorestaTestFramework.get_integration_test_dir() | ||
targetdir = FlorestaTestFramework.get_target_release_dir() | ||
|
||
# So, check for it first before define the florestad path. | ||
if os.path.exists(tmpdir): | ||
florestad = os.path.normpath(os.path.join(tmpdir, "florestad")) | ||
|
||
# If not exists, define the one at ./target/release. | ||
elif os.path.exists(targetdir): | ||
florestad = os.path.normpath(os.path.join(targetdir, "florestad")) | ||
|
||
# In case any test florestad is found, raise an exception | ||
else: | ||
raise RuntimeError( | ||
f"Not found 'florestad' in '{tmpdir}' or '{targetdir}'. " | ||
"Run 'tests/prepare.sh' or 'cargo build --release'." | ||
) | ||
|
||
print(f"Using {florestad}") | ||
setting = { | ||
"chain": chain, | ||
"config": [ | ||
florestad, | ||
"florestad", |
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.
Here, i had to delete this piece made by @qlrd.
(Just publicizing a talk that i had with him via dm).
IMO this whole test battery shouldnt manipulate external binaries at all and just blindly call it from the environment. In this way, one that is running the tests can properly set the binaries. Thats what i tried to do with prepare.sh
and run.sh
.
ef46a8d
to
4d84e64
Compare
go | ||
] ++ [ self.packages.${system}.default ]; | ||
] ++ pythonDeps; |
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.
Some of these python deps are duplicated now right?
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.
AFAIK poetry will not install already installed deps... But worth checking...
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.
Ah ok, I see. I thought there were dups in the flake too, but I see how the python deps are spilt now.
nixpkgs-fmt.enable = true; | ||
}; | ||
}; | ||
#TODO: Add relevant checks here to be executed by CI with nix flake check |
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.
Are these related to the python stuff?
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.
No, but this will leace space for some changes that was discussed in the last bi weekly reunion at our discord. Pre commit was only doing redundant job that Actions was already doing.
@jaoleal I am trying to run this locally and still seeing a weird issue where it is prompting me for my root password. I think it is due to dependencies, but I see the "no-root" arg on poetry so confused where it is coming from. I'll keep poking around. This is what I see when prompted:
|
I am not sure if this is an option, but I got things working by just not using poetry:
|
@nyonson, i would like to point a little thing if you permit:
The mentioned
Generally, without Maybe |
Ah, thanks, I totally misinterpreted that flag. I am still not sure exactly why poetry makes things upset, but probably not the no-root flag. |
cc @nyonson Im afraid not, i want nix to have similar behavior than our CI. If CI fail, nix must fail too and vice versa. |
That makes sense. I am poking around a few more strategies just out of curiosity and learning, but don't think they will make the cut unless CI is tweaked too. This dev shell below technically works, but also shows off why python deps in nix is kind of painful. Some packages are in the
Another option is this poetry2nix project. Although it looks like it is unmaintained at the moment (Looks like If instead the
|
This A try on it wouldn't hurt.
Basically, what
I believe that, with careful consideration, it would be possible to swap |
Looks like there is a nice uv2nix project to do the reproducible mapping. EDIT: Although, maybe worth just using poetry2nix right now cause this looks very simple: https://github.com/nix-community/poetry2nix?tab=readme-ov-file#mkpoetryenv |
Allow me to correct your typo. "shows off why python deps
Ill be studying that option. |
I can try test with |
Hehe yea, to your point, check out the "basic" usage of the uv2nix project...does enforce my bias to avoid python deps at almost all costs. |
What is the purpose of this pull request?
Which crates are being modified?
Description
Notes to the reviewers
The new
runPythonTests
variation was needed to provide a variation that doesnt execute the tests in its invocation, which is namedpythonTests
onlyChecklist
just lint
cargo test