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.

DeprecationWarning when used with pytest

See original GitHub issue

Describe the bug Using pyfakefs with pytest produces a deprecation warning about the compiler package as soon as a test depends on the fs fixture.

plugins: pyfakefs-3.5.6
collected 1 item

tests/test_foo.py .                                                                                           [100%]

================================================= warnings summary ==================================================
tests/test_foo.py::test_fs
  /usr/local/miniconda3/envs/alpenhorn/lib/python2.7/site-packages/py/_code/_assertionold.py:3: DeprecationWarning: The compiler package is deprecated and removed in Python 3.x.
    from compiler import parse, ast, pycodegen

-- Docs: https://docs.pytest.org/en/latest/warnings.html
======================================= 1 passed, 1 warnings in 0.11 seconds ========================================

How To Reproduce Put the following into test_foo.py:

def test_foo(fs):
    pass

Then run pytest test_foo.py.

Your enviroment Please run the following and paste the output.

Darwin-18.0.0-x86_64-i386-64bit
('Python', '2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39) \n[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]')
('pyfakefs', '3.5.6')

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mrbean-bremencommented, Mar 28, 2019

@diefans - thanks for that - this works nicely! I obviously had put the filter into the wrong place. And we can make this very specific to suppress only this one warning…

0reactions
diefanscommented, Mar 25, 2019

When I put catch_warnings context around modules = ... I do not get deprecation warnings in python 2.7…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecations and Removals — pytest documentation
The objective is to give users a clear rationale why a certain feature has been removed, and what alternatives should be used instead....
Read more >
How to suppress py.test internal deprecation warnings
Disabling all warnings persistently (i.e. using pytest.ini) is almost never a good idea. Disabling just Deprecation warning (and by module) as ...
Read more >
DeprecationWarning when used with pytest #466 - GitHub
Describe the bug Using pyfakefs with pytest produces a deprecation warning about the compiler package as soon as a test depends on the...
Read more >
Suppress Warnings in pytest | SukhbinderSingh.com
Recently had this issue with pytest. ... DeprecationWarning: i nspect.getargspec() is deprecated, use inspect.signature()…
Read more >
DeprecationWarning about distutils running pytest tests
plugins/python/helpers/pycharm/_jb_pytest_runner.py:6: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use ...
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