mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
Fixed `$AUTO_CD
` regress after previous refactoring. (#5629)
* fix autocd * test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
aed574004d
commit
31e7c4204a
3 changed files with 33 additions and 1 deletions
23
news/fix_autocd.rst
Normal file
23
news/fix_autocd.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Fixed ``$AUTO_CD`` regress after previous refactoring.
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -577,3 +577,12 @@ def test_alias_return_command_eval_inside(xession):
|
|||
assert spec.cmd == ["sudo", "echo", "1"]
|
||||
assert spec.alias_name == "xsudo"
|
||||
assert spec.threadable is True
|
||||
|
||||
|
||||
def test_auto_cd(xession, tmpdir):
|
||||
xession.aliases["cd"] = lambda: "some_cd_alias"
|
||||
dir = str(tmpdir)
|
||||
with xession.env.swap(AUTO_CD=True):
|
||||
spec = cmds_to_specs([[dir]], captured="object")[-1]
|
||||
assert spec.alias.__name__ == "cd"
|
||||
assert spec.cmd[0] == dir
|
||||
|
|
|
@ -764,7 +764,7 @@ class SubprocSpec:
|
|||
):
|
||||
return
|
||||
self.cmd.insert(0, "cd")
|
||||
self.alias = XSH.aliases.get("cd", None)
|
||||
self.alias = XSH.aliases.get("cd", None)[0]
|
||||
|
||||
def resolve_executable_commands(self):
|
||||
"""Resolve command executables, if applicable."""
|
||||
|
|
Loading…
Add table
Reference in a new issue