Fix Xonsh test

This commit is contained in:
Ajeet D'Souza 2021-08-15 20:37:19 +05:30
parent e9e8aa04c7
commit 04924bbec0
4 changed files with 9 additions and 12 deletions

View File

@ -1,7 +1,7 @@
let
rust = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz");
rust = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/ad311f5bb5c5ef475985f1e0f264e831470a8510.tar.gz");
pkgs = import <nixpkgs> { overlays = [ rust ]; };
pkgs-latest = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/94e725d3299cbeb71419758d671dfb0771b8e318.tar.gz") {};
pkgs-latest = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/1359293549af4f8ca536716d0432f3cdd0afe0c6.tar.gz") {};
pkgs-python = pkgs-latest.python3.withPackages (pkgs: [ pkgs.black pkgs.mypy pkgs.pylint ]);
in
pkgs.mkShell {

View File

@ -356,15 +356,12 @@ mod tests {
let opts = Opts { cmd, hook, echo, resolve_symlinks };
let source = Xonsh(&opts).render().unwrap();
// We can't pass the source directly to `xonsh -c` due to
// a bug: <https://github.com/xonsh/xonsh/issues/3959>
let tempdir = tempfile::tempdir().unwrap();
let tempdir = tempdir.path().to_str().unwrap();
Command::new("xonsh")
.args(&[
"-c",
"import sys; execx(sys.stdin.read(), 'exec', __xonsh__.ctx, filename='zoxide')",
"--no-rc",
])
.write_stdin(source.as_bytes())
.args(&["-c", &source, "--no-rc"])
.env("HOME", tempdir)
.assert()
.success()
.stdout("")

View File

@ -1,7 +1,7 @@
{%- let section = "# =============================================================================\n#" -%}
{%- let not_configured = "# -- not configured --" -%}
"""Initialize zoxide on Xonsh."""
# pylint: disable=missing-module-docstring
import builtins # pylint: disable=unused-import
import os

View File

@ -59,7 +59,7 @@ function __zoxide_z() {
\builtin printf 'zoxide: $OLDPWD is not set'
return 1
fi
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
elif [ "$#" -eq 1 ] && [ -d "$1" ]; then
__zoxide_cd "$1"
else
\builtin local __zoxide_result