Skip to content

Commit 3cee8ff

Browse files
committed
Removed glob from patched modules
- as discussed with jmcgeheeiv
1 parent 1b352a6 commit 3cee8ff

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

pyfakefs/fake_filesystem_unittest.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
"""A base class for unit tests using the :py:class:`pyfakefs` module.
1717
18-
This class searches `sys.modules` for modules that import the `os`, `glob`,
19-
`shutil`, and `tempfile` modules.
18+
This class searches `sys.modules` for modules that import the `os`, `io`,
19+
`path`, and `tempfile` modules.
2020
2121
The `setUp()` method binds these modules to the corresponding fake
2222
modules from `pyfakefs`. Further, the built in functions `file()` and
@@ -47,7 +47,6 @@
4747
import doctest
4848
import inspect
4949
from pyfakefs import fake_filesystem
50-
from pyfakefs import fake_filesystem_glob
5150
from pyfakefs import fake_filesystem_shutil
5251
from pyfakefs import fake_tempfile
5352
if sys.version_info < (3,):
@@ -120,8 +119,8 @@ class Patcher(object):
120119
Instantiate a stub creator to bind and un-bind the file-related modules to
121120
the :py:mod:`pyfakefs` fake modules.
122121
'''
123-
SKIPMODULES = set([None, fake_filesystem, fake_filesystem_glob,
124-
fake_filesystem_shutil, fake_tempfile, sys])
122+
SKIPMODULES = set([None, fake_filesystem, fake_filesystem_shutil,
123+
fake_tempfile, sys])
125124
'''Stub nothing that is imported within these modules.
126125
`sys` is included to prevent `sys.path` from being stubbed with the fake
127126
`os.path`.
@@ -130,12 +129,11 @@ class Patcher(object):
130129

131130
# To add py.test support per issue https://github.com/jmcgeheeiv/pyfakefs/issues/43,
132131
# it appears that adding 'py', 'pytest', '_pytest' to SKIPNAMES will help
133-
SKIPNAMES = set(['os', 'glob', 'path', 'tempfile', 'io'])
132+
SKIPNAMES = set(['os', 'path', 'tempfile', 'io'])
134133

135134
def __init__(self):
136135
# Attributes set by _findModules()
137136
self._osModules = None
138-
self._globModules = None
139137
self._pathModules = None
140138
self._shutilModules = None
141139
self._tempfileModules = None
@@ -148,7 +146,6 @@ def __init__(self):
148146
self._stubs = None
149147
self.fs = None
150148
self.fake_os = None
151-
self.fake_glob = None
152149
self.fake_path = None
153150
self.fake_shutil = None
154151
self.fake_tempfile_ = None
@@ -167,7 +164,6 @@ def _findModules(self):
167164
modules.
168165
'''
169166
self._osModules = set()
170-
self._globModules = set()
171167
self._pathModules = set()
172168
self._shutilModules = set()
173169
self._tempfileModules = set()
@@ -179,8 +175,6 @@ def _findModules(self):
179175
continue
180176
if 'os' in module.__dict__:
181177
self._osModules.add(module)
182-
if 'glob' in module.__dict__:
183-
self._globModules.add(module)
184178
if 'path' in module.__dict__:
185179
self._pathModules.add(module)
186180
if 'shutil' in module.__dict__:
@@ -198,7 +192,6 @@ def _refresh(self):
198192

199193
self.fs = fake_filesystem.FakeFilesystem()
200194
self.fake_os = fake_filesystem.FakeOsModule(self.fs)
201-
self.fake_glob = fake_filesystem_glob.FakeGlobModule(self.fs)
202195
self.fake_path = self.fake_os.path
203196
self.fake_shutil = fake_filesystem_shutil.FakeShutilModule(self.fs)
204197
self.fake_tempfile_ = fake_tempfile.FakeTempfileModule(self.fs)
@@ -224,8 +217,6 @@ def setUp(self, doctester=None):
224217

225218
for module in self._osModules:
226219
self._stubs.SmartSet(module, 'os', self.fake_os)
227-
for module in self._globModules:
228-
self._stubs.SmartSet(module, 'glob', self.fake_glob)
229220
for module in self._pathModules:
230221
self._stubs.SmartSet(module, 'path', self.fake_path)
231222
for module in self._shutilModules:
@@ -241,8 +232,6 @@ def replaceGlobs(self, globs_):
241232
self._refresh()
242233
if 'os' in globs:
243234
globs['os'] = fake_filesystem.FakeOsModule(self.fs)
244-
if 'glob' in globs:
245-
globs['glob'] = fake_filesystem_glob.FakeGlobModule(self.fs)
246235
if 'path' in globs:
247236
fake_os = globs['os'] if 'os' in globs \
248237
else fake_filesystem.FakeOsModule(self.fs)

0 commit comments

Comments
 (0)