Commit graph

26 commits

Author SHA1 Message Date
Gil Forsyth
0fe0a6c03e
fix(dirstack): use XSH.env for $HOME check, not os.path (#5211)
`os.path.expanduser` relies on the value of `$HOME` set in `os.environ`.
This meant that a user who set `$HOME` would then not end up in that
directory with a no-argument call to `cd` unless they had set
`UPDATE_OS_ENVIRON`.

Now the value of `$HOME` is respected regardless of the setting in `UPDATE_OS_ENVIRON`
2023-09-25 14:53:15 +06:00
Andy Kipp
237e231e7f
Moving chdir to xonsh.tools (#5073)
* chdir

* [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>
2023-03-02 12:31:08 +05:30
Noortheen Raja
78091a22f3 style: isort imports
fix #4584
2022-01-31 11:16:51 -05:00
Noorhteen Raja NJ
7c4e207abd
update test xsh usage (#4581)
* todo

* test: remove usage of DummyEnv and setting .env attribute on xession fixture

one step closer to making too much of tweaking to xession during tests

* test: fix tests vox and gitstatus-prompt

* docs: update test-fixture usage

* fix: import flake8 error

* test: remove direct access to XSH in tests

* test: remove usage of XSH in test files

* todo

* test: use tmp-dir to create stubs

* refactor: use fixture factory to mock out XonshSession

* refactor: remove direct access of XSH from functions

* refactor: remove direct access of XSH from functions

* fix: qa checks

* refactor: rename variables to match their values

* test: update failing tests because it had no PATH set previously

* fix: remove builtins usage from pyghooks.py

* style:

* refactor: update tests to use fixtures

* fix: env varialbe is setup per function

some tests accidentally update the env variables and that is leaking
into next tests

* fix: failing vox tests

* test: set commands_cache per test

* test: fix failing tests

* fix: failing tests on linux

ptk-highlight

* fix: failing tests on Windows

cwd-prompt

* test: copy env as to not affect original object

* fix: lazily evaluate cmds-cache in pyghooks

* test: fix failing tests

* fix: qa errors import

* test: set commands-cache per test

while caching path results

* test: speedup test_thread_local_swap

* fix: failing tests on windows

* refactor: Execer doesn't control session

* refactor: XSH.unload will take care of reversing builtins attrs set

* test: use env.update over monkeypatch

* Revert "test: use env.update over monkeypatch"

This reverts commit 010a5022247a098f1741966b8af1bf758663480e.
2022-01-07 17:33:22 -05:00
Noorhteen Raja NJ
c2d25ac251
pre-commit hook for pyupgrade (#4583)
* chore: add pyupgrade

* refactor: upgrade code to py3.7+

ran `pre-commit run pyupgrade -a` while excluding changes to ply

* fix: flake errors
2021-12-06 14:42:26 -05:00
Noorhteen Raja NJ
38295a1dd9
Remove globals (#4280)
* refactor: remove usage of global variables in abbrevs.py

* chore: add flake8-mutable to prevent mutable defaults

* fix: abbrevs expand test

* refactor: add xonsh session singleton

* refactor: fix circular errors when using xonshSession as singleton

* refactor: remove black magicked builtin attributes

* style: black format tests as well

* refactor: update tests to use xonsh-session singleton

* refactor: update abbrevs to not use builtins

* test: remove DummyCommandsCache and patch orig class

* fix: failing test_command_completers

* test: use monkeypatch to update xession fixture

* fix: failing test_pipelines

* fix: failing test_main

* chore: run test suit as single invocation

* test: fix tests/test_xonsh.xsh

* refactor: remove builtins from docs/conf.py

* fix: mypy error in jobs

* fix: test error from test_main

* test: close xession error in test_command_completers

* chore: use pytest-cov for reporting coverage

this will include subprocess calls, and will increase coverage

* style:
2021-05-20 13:14:26 +03:00
Bob Hyman
26475146e2
Flake8 1 (#3550)
* flake8 fixes -- tests only

* fix ci failure

* integrate fix from is_3551 so tests will pass.

* Update tests/test_builtins.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
2020-05-05 06:42:28 -04:00
Anthony Scopatz
4c91df2abc many test fixes 2018-09-13 14:03:35 -04:00
Anthony Scopatz
634a8ec9f2 black tests 2018-08-30 09:18:49 -05:00
Jamie Bliss
be30c54f3a Update on_chdir 2017-01-14 18:40:29 -05:00
laerus
e2174dc34d test_dirstack::test_cdpath_expansion leaving stray dirs 2016-09-21 14:45:58 +03:00
Bob Hyman
87117203ad fix test failures (possibly caused by context manager monkeying with globals?) 2016-09-07 21:37:33 -04:00
Bob Hyman
1eab95ed5e fire chdir event when os change wd detected; also fix cd '.' with AUTO_PUSHD 2016-09-05 20:36:45 -04:00
Bob Hyman
13912e90b9 manual merge 2016-08-31 20:09:14 -04:00
Jamie Bliss
ab6501748d Use singleton instance of EventManager 2016-08-27 12:21:15 -04:00
Jamie Bliss
573e78372f Add on_chdir event and test.
Test is, of course, failing
2016-08-27 12:06:16 -04:00
Bob Hyman
6fbe13b2ed unc mapping tests pass; need to test registry later 2016-08-04 23:59:27 -04:00
Bob Hyman
ff6685b97e interim 2016-08-04 20:52:41 -04:00
Konstantinos Tsakiltzidis
2f2f1622c9 'test_builtins' 2016-06-29 18:32:42 +03:00
Konstantinos Tsakiltzidis
a48e53130b test_aliases/test_dirstack 2016-06-26 02:05:26 +03:00
Konstantinos Tsakiltzidis
c7aabbb3b5 'nose bleeds' 2016-06-23 12:48:01 +03:00
Konstantinos Tsakiltzidis
3f110d5f62 'dirstack foreign_shells' 2016-06-22 22:57:50 +03:00
adam j hartz
d474f10818 update tests appropriately 2016-06-06 22:08:17 -04:00
Sébastien Pierre
f68650a218 Added tests, CHANGELOG and expand_path support to #916 2016-05-18 09:42:36 -04:00
Kurtis Rader
e88c863d10 Add a uniform character encoding to all files.
I wouldn't normally do something like this but issue #487 brought to
my attention the fact that too many of the python modules don't have
an encoding comment and of those that do there is a lot of pointless
inconsistency in the style of the comment.
2015-11-16 14:10:40 -08:00
Matteo Bertini
e130c6f96f Add support for CDPATH 2015-07-04 01:06:27 +02:00