Commit graph

42 commits

Author SHA1 Message Date
Angus Hollands
7eceb7f956
Feat: add Aliases.register (#4547)
* Feat: add `Aliases.register`

* Fix: return func from decorator

* Feat: support private name

* Fix: use local name

* Test: test aliases decorator

* Update news/feat-add-alias-decorator.rst

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>

* Update feat-add-alias-decorator.rst

* Update test_aliases.py

* Update aliases.py

* Update test_aliases.py

* Update aliases.py

Co-authored-by: Gil Forsyth <gforsyth@users.noreply.github.com>
Co-authored-by: Noorhteen Raja NJ <jnoortheen@gmail.com>
2022-01-21 16:30:23 +05:30
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
50a1c92004
chore: enable flake8 for tests (#4482) 2021-09-26 11:32:24 -04:00
Noorhteen Raja NJ
73cf0c27be
test: remove redundant xonsh session mock fixture (#4390)
xonsh_execer
2021-07-25 18:38:10 +03: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
Andy Kipp
039ce96dcd
feat: Added ability to get arguments list in ExecAlias (#4201)
* black

* news

* test

* alias_argN

* ExecAlias docs

* note about merge operator

* $args

* docs

Co-authored-by: a <a@a.a>
2021-04-15 09:39:13 -04:00
Asaf Fisher
da415caf06
Add 'dict' merging operation for the aliases class (#4037)
* aliases: Add merging operation to the aliases dict

* tests: Add tests to the aliases merging operation

* news: Add summary about the Alias merging functionality
2021-01-04 12:44:21 -05:00
Daniel Shimon
cf87c2fdc8 aliases: Create ExecAlias for aliases that contain IO operators 2020-10-23 15:45:31 +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
Bob Hyman
94ac8f67f5
black-fix - split from ls_color for separate review (#3431)
* black-fix - split from ls_color for separate review
2020-02-14 09:09:34 -05:00
Gil Forsyth
e4fada56b0 Allow logical operators within aliases
This fixes #3270 and logical operators within aliases now resolve correctly.

I've added in `&&`, `||`, `and`, and `or`

```
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ aliases['echocat'] = 'echo "hi" and echo "there"'
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ echocat
hi
there
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ aliases['echocat'] = 'echo "hi" or echo "there"'
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ echocat
hi
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ aliases['echocat'] = 'echo "hi" && echo "there"'
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ echocat
hi
there
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ aliases['echocat'] = 'echo "hi" || echo "there"'
(base)   ~/githu/xonsh/xonsh logical_op_aliases $ echocat
hi
```
2019-08-16 15:17:31 -04:00
Anthony Scopatz
a00cf04a5f black 2019-02-04 16:17:02 -05:00
Anthony Scopatz
b2faa470cd news and tests 2019-02-04 16:15:29 -05:00
Anthony Scopatz
51f5002506 fixed eval aliases 2019-01-28 17:17:55 -05:00
Anthony Scopatz
fe82924ca9 add execer 2018-11-19 20:01:20 -05:00
Anthony Scopatz
2287067a11 try to fix alias tests by removing global state 2018-11-19 19:51:15 -05:00
Anthony Scopatz
c3c694d088 try builtins 2018-11-11 09:15:23 -06:00
Anthony Scopatz
1502efeef5 try to fix tests 2018-11-10 00:25:47 -06: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
laerus
2dd7c5541d which refactor p1 2016-09-26 22:33:51 +03:00
Konstantinos Tsakiltzidis
ba6f63f143 Merge branch 'master' into pytest_migration 2016-06-29 16:58:08 +03:00
Anthony Scopatz
3276d06f01 removed ENV 2016-06-28 20:22:11 -04:00
Konstantinos Tsakiltzidis
a48e53130b test_aliases/test_dirstack 2016-06-26 02:05:26 +03:00
Konstantinos Tsakiltzidis
daf3f89ae8 TODO list, conftest.py, some migrations 2016-06-25 01:15:48 +03:00
Konstantinos Tsakiltzidis
4b5119fc75 Merge branch 'master' into pytest_port 2016-06-23 03:02:39 +03:00
Konstantinos Tsakiltzidis
90fdda6908 test_builtins 2016-06-22 22:50:01 +03:00
Konstantinos Tsakiltzidis
8a0c447d96 test_aliases 2016-06-22 22:45:42 +03:00
Gil Forsyth
2c26fcaa64 update setup and teardown calls. only 1 test failing 2016-06-22 11:41:06 -04:00
Anthony Scopatz
696de57702 another win fix 2016-06-21 11:50:04 -04:00
Anthony Scopatz
e88abafc92 pathext windows test fixes 2016-06-21 11:43:08 -04:00
Morten Enemark Lund
cba99b5a7b Updated tests to match the new whichgen returns 2016-05-18 23:09:35 +02:00
Morten Enemark Lund
f3e3362204 Add tests for which functionality. This does not test the actual alias function, only the whichgen() function we are using from the external which.py module. 2016-05-17 11:28:34 +02:00
Anthony Scopatz
4862a47b7c fixed alias expansion 2016-04-10 12:13:36 -04:00
adam j hartz
a5f2b7019e skip more test cases on windows 2015-12-19 18:44:58 -05:00
adam j hartz
3c487284b4 more test case fiddling 2015-12-19 18:09:06 -05:00
adam j hartz
36ba1b14bf update tests for new aliasing 2015-12-19 17:29:48 -05: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
Klaus Alexander Seistrup
ee65f492f2 Removed trailing whitespace 2015-07-29 23:58:25 +02:00
Anthony Scopatz
402e393ad1 some test improvements 2015-03-25 18:32:10 -05:00
Mattias Ugelvik
1483159dd2 Recursive alias evaluation 2015-03-22 02:46:33 +01:00