Skip to content

Commit

Permalink
Suppress specific pytest warning under Python 2.7
Browse files Browse the repository at this point in the history
- fixes #466
  • Loading branch information
mrbean-bremen committed Mar 28, 2019
1 parent 78543fb commit 7186b98
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The release versions are PyPi releases.
#### New Features
* added support for `os.pipe` (see [#473](../../issues/473))

#### Fixes
* avoid pytest warning under Python 2.7 (see [#466](../../issues/466))

## [Version 3.5.8](https://pypi.python.org/pypi/pyfakefs/3.5.8)

Another bug-fix release that mainly fixes a regression wih Python 2 that has
Expand Down
13 changes: 11 additions & 2 deletions pyfakefs/fake_filesystem_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import sys
import tempfile
import unittest
import warnings
import zipfile # noqa: F401 make sure it gets correctly stubbed, see #427

from pyfakefs.helpers import IS_PY2, IS_PYPY
Expand Down Expand Up @@ -478,8 +479,16 @@ def is_fs_function(fct):
# see https://github.com/pytest-dev/py/issues/73
continue

modules = {name: mod for name, mod in module.__dict__.items()
if is_fs_module(mod, name)}
# suppress specific pytest warning - see #466
with warnings.catch_warnings():
warnings.filterwarnings(
'ignore',
message='The compiler package is deprecated',
category=DeprecationWarning,
module='py'
)
modules = {name: mod for name, mod in module.__dict__.items()
if is_fs_module(mod, name)}
for name, mod in modules.items():
self._modules.setdefault(name, set()).add((module,
mod.__name__))
Expand Down
2 changes: 1 addition & 1 deletion pyfakefs/tests/fake_pathlib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ def test_getatime(self):
self.skip_real_fs()
dir1 = self.make_path('foo', 'bar1.txt')
path_obj = self.filesystem.create_file(dir1)
path_obj.SetATime(11)
path_obj.st_atime = 11
self.assertEqual(self.os.path.getatime(dir1),
self.os.path.getatime(self.path(dir1)))

Expand Down

0 comments on commit 7186b98

Please sign in to comment.