Skip to content

Commit f4aac8e

Browse files
committed
Do not import pandas and related modules if it is not patched
- see #627
1 parent 49d4201 commit f4aac8e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The released versions correspond to PyPi releases.
88
* improved handling of `str`/`bytes` paths
99
* suppress all warnings while inspecting loaded modules
1010
(see [#614](../../issues/614))
11+
* do not import pandas and related modules if it is not patched
12+
(see [#627](../../issues/627))
1113

1214
### Infrastructure
1315
* added test dependency check (see [#608](../../issues/608))

pyfakefs/fake_filesystem_unittest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
)
6060
from pyfakefs.helpers import IS_PYPY
6161
from pyfakefs.mox3_stubout import StubOutForTesting
62-
from pyfakefs.patched_packages import (
63-
get_modules_to_patch, get_classes_to_patch, get_fake_module_classes
64-
)
6562

6663
try:
6764
from importlib.machinery import ModuleSpec
@@ -474,6 +471,11 @@ def __init__(self, additional_skip_names: Optional[
474471
self.use_cache = use_cache
475472

476473
if use_known_patches:
474+
from pyfakefs.patched_packages import (
475+
get_modules_to_patch, get_classes_to_patch,
476+
get_fake_module_classes
477+
)
478+
477479
modules_to_patch = modules_to_patch or {}
478480
modules_to_patch.update(get_modules_to_patch())
479481
self._class_modules.update(get_classes_to_patch())

0 commit comments

Comments
 (0)