Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XONSH support #29

Open
tkossak opened this issue Mar 29, 2017 · 5 comments
Open

XONSH support #29

tkossak opened this issue Mar 29, 2017 · 5 comments

Comments

@tkossak
Copy link

tkossak commented Mar 29, 2017

Hi,

I forked this repo and tried adding support to xonsh shell but i have problems with tests. Can someone more experienced with python/pytest look at these errors and tell me if I did something wrong (and what)?

Xonsh must be treated similarly to ptpython, so PrettyDir.__repr__() method should print self.repr_str not return it (just like for ptpython). So I made small changes in https://github.com/tkossak/pdir2/commit/24c43ba9bb05b732c66ae09e665dbb5dc4f0e95c and it works for me. The problem is with tests, which now return these errors. For me it seems like for xonsh and ptpython this assert: result.repr_str == repr(result) should always fail because __repr__() always returns null string for these shells. If so, why the tests work for ptpython and not for xonsh?

Thank you.

@laike9m
Copy link
Owner

laike9m commented Mar 29, 2017

Actually no tests is run in ptpython, the only test that is written for ptpython is
https://github.com/laike9m/pdir2/blob/master/tests/interactive_test.py
which doesn't even have an assert statement.

I've not used xonsh before, but if it's only a different shell, tests shouldn't break. Could you tell me what commands you typed and how you run tests?

@tkossak
Copy link
Author

tkossak commented Mar 29, 2017

I run tests by typing pytest or pytest -v. I tried these commands both in xonsh and in bash and they end the same (with errors). The line that is causing problems is api.py:45. If I change this one line to original, all the tests pass successfully.

Maybe I invoke pytest wrongly, and these tests shouldn't run at all for xonsh (you said they don't run for ptpython either).

Xonsh is python shell (you can run all python commands directly in it).

@laike9m
Copy link
Owner

laike9m commented Mar 30, 2017

@tkossak Thanks for opening this issue.

After playing with xnosh a bit, I don't think it's easy to get pdir2 working on it. As there're many features of higher priority there, I won't put much effort into this in the near future. However, I still encourage you to go deeper to find out the root cause, because in most cases it's the REPL's inconsistency with others that caused problems, like this one.

@tkossak
Copy link
Author

tkossak commented Mar 30, 2017

I'll try to figure out why tests fail, but i actually use pdir2 withy this change and it works perfectly fine under xonsh, ipython and python.

@laike9m
Copy link
Owner

laike9m commented Mar 30, 2017

Alright, that's good to hear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants