question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mutilated pytest stack traces

See original GitHub issue

On Python 2.7, stack traces are garbled when using the fs pytest fixture:

test.py:

def test(fs):
    assert 0

bash:

$ virtualenv venv --no-site-packages
$ . venv/bin/activate
(venv) $ pip install pytest pyfakefs
(venv) $ pytest test.py

Output:

_____________________________________ test ______________________________________

fs = <pyfakefs.fake_filesystem.FakeFilesystem object at 0x10efdbc50>

>   ???
E   assert 0

test.py:2: AssertionError

Output without including fs fixture:

_____________________________________ test ______________________________________

    def test():
>       assert 0
E       assert 0

test.py:2: AssertionError

Any ideas? Sorry if this has already been reported somewhere (I couldn’t find an issue for it).

Python version: 2.7.14 pip version: 10.0.1 virtualenv version: 15.1.0 pip freeze output:

attrs==17.4.0
funcsigs==1.0.2
more-itertools==4.1.0
pluggy==0.6.0
py==1.5.3
pyfakefs==3.4.1
pytest==3.5.1
six==1.11.0

Thanks, Karl

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
jmcgeheeivcommented, May 1, 2018

Thank you for the great triage and the Python 3 fix, @mrbean-bremen.

I will give it a try, but like @mrbean-bremen, I am not so experienced with pytest.

1reaction
mrbean-bremencommented, Apr 29, 2018

I seem to have found a solution for this under Python 3 (happened there too), but under Python 2 it still does not work. Not faking the open function fixes it, but that is not an option…

Read more comments on GitHub >

github_iconTop Results From Across the Web

mutilated pytest stack traces · Issue #381 · jmcgeheeiv/pyfakefs
On Python 2.7, stack traces are garbled when using the fs pytest fixture: test.py: def test(fs): assert 0 bash: $ virtualenv venv --no-site-packages ......
Read more >
How can I make py.test print stack traces for test failures ...
I can't seem to find an option to print out the stack traces as each test completes. -s doesn't help. python · pytest...
Read more >
Managing pytest's output
The --full-trace causes very long traces to be printed on error (longer than --tb=long ). It also ensures that a stack trace is...
Read more >
Print or retrieve a stack traceback
This module provides a standard interface to extract, format and print stack traces of Python programs. It exactly mimics the behavior of the...
Read more >
Capturing Stack Traces
It's great being able to log events, but what if we want to log something critical, like a crash? We can do that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found