xonsh / xonsh

:shell: Python-powered shell. Full-featured and cross-platform.
http://xon.sh
Other
8.47k stars 643 forks source link

Test failure building for NixOS #5569

Open greg-hellings opened 5 months ago

greg-hellings commented 5 months ago

Current Behavior

Trying to build the released 0.17.0 version for nixpkgs, I have gotten tests running with the exception of test_spec_modifier_alias_output_format. It appears to be searching for the echo command, which seems like it's typically a built-in function. For some reason, during this particular test, it is searching instead for echo to be a system executable.

```xsh =================================== FAILURES =================================== ____________________ test_spec_modifier_alias_output_format ____________________ xession = @skip_if_on_windows def test_spec_modifier_alias_output_format(xession): class SpecModifierOutputLinesAlias(SpecModifierAlias): def on_modifer_added(self, spec): spec.output_format = "list_lines" xession.aliases["xlines"] = SpecModifierOutputLinesAlias() cmds = [["xlines", "echo", "1\n2\n3"]] specs = cmds_to_specs(cmds, captured="stdout") (p := _run_command_pipeline(specs, cmds)).end() > assert p.output == ["1", "2", "3"] E AssertionError: assert [] == ['1', '2', '3'] E E Right contains 3 more items, first extra item: '1' E Use -v to get more diff tests/procs/test_specs.py:331: AssertionError ----------------------------- Captured stderr call ----------------------------- xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True xonsh: subprocess mode: command not found: 'echo' ```

Expected Behavior

Tests build and succeed in nixpkgs/NixOS builds if the appropriate set of dependency packages is present.

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

anki-code commented 5 months ago

hey! Maybe it's related to #5003. The good start point is to provide repeatable list of commands in docker like this - https://github.com/xonsh/xonsh/issues/5003#issuecomment-2127665481

SamLukeYes commented 3 months ago

The test was renamed to test_spec_decorator_alias_output_format in https://github.com/xonsh/xonsh/pull/5579, and is still failing when building xonsh 0.18.2 in https://github.com/NixOS/nixpkgs/pull/325813

anki-code commented 3 months ago

As I see in the first message:

xonsh: subprocess mode: command not found: 'echo'

So it's mostly about isolation in Nix I think. Why there is no echo during running test? It's interesting why only this test fails because all other tests also based on echo.

anki-code commented 3 months ago

// Just thought: what about adding Nix to xonsh CI? Is it possible?

SamLukeYes commented 3 months ago

// Just thought: what about adding Nix to xonsh CI? Is it possible?

Though I'm a noob at GitHub actions setup, I know there are some actions that make use of Nix, e.g. cachix/install-nix-action. Also consider Garnix CI, which builds packages and checks in a Flake hosted on GitHub. Additionally, adding flake.nix to this repo would allow Nix Flakes users to use or test the latest main branch of Xonsh easily, though its packaging might need to be simplified, compared to the one in Nixpkgs, which is still a headache to me :rofl:

greg-hellings commented 3 months ago

Yes, we can help add Nix tests and builds directly to this repository. I'm on a trip right now, but I would be happy to help with this over the next few days.