kaste / PyTest

pytest runner and view annotator for sublime text
21 stars 6 forks source link

Inline view annotation on failure not working? #1

Closed zhanglix closed 7 years ago

zhanglix commented 7 years ago

I installed the plugin yesterday, and found it was great! 👍 Thank you for sharing such a great plugin for sublime3, which make it much easier for me to develop in python with pytest and sublime.

But I can not figure out how to make the inline annotation feature working. I setup a project with only one test file and with the default setting of PyTest. The test run automatically on save, but do not annotate the views on failures.

Here is the screen short of my sublime.

pytest_subl_snapshot

There are some errors in the console, which I suppose to not relate to the problem:

modified Run py.test --tb=auto -l /Users/zhangli/local_workshop/practice/pytest_subl/test_it.py Traceback (most recent call last): File "/Users/zhangli/Library/Application Support/Sublime Text 3/Packages/PyTest/pytest_exec.py", line 144, in parse_result tree = etree.parse(get_report_file()) File "lxml.etree.pyx", line 3310, in lxml.etree.parse (src/lxml/lxml.etree.c:72517) File "parser.pxi", line 1791, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:105979) File "parser.pxi", line 1817, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:106278) File "parser.pxi", line 1721, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:105277) File "parser.pxi", line 1122, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:100227) File "parser.pxi", line 580, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:94350) File "parser.pxi", line 690, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:95786) File "parser.pxi", line 618, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:94818) OSError: Error reading file '/Users/zhangli/Library/Application Support/Sublime Text 3/Cache/PyTest/last-run.xml': failed to load external entity "/Users/zhangli/Library/Application Support/Sublime Text 3/Cache/PyTest/last-run.xml"

btw: I'm using the latest master branch of PyTest of commit c36cb0fac269ede61b9f93f7a34cf6f6e7416b22

zhanglix commented 7 years ago

It seems that the problem is caused by the 'shell' options passed to exec.ExecCommand.run() method. I set the 'shell' option to False, then everything works well. :)

Since I do not familiar with the api of sublime, I'm not sure if it is the root cause. I will make a pull request for this issue so that you can review the change I made. Maybe you will find the real cause.

kaste commented 7 years ago

Thank you for debugging this. I wonder if sublime will pick the correct setting for shell if we just don't set anything here? Otherwise this is platform dependent: on *nix it should be false, on win true.

kaste commented 7 years ago

Basically pushed as 0.6.3. For now I just don't set shell and let sublime decide. :bowtie: