Skip to content

Commit

Permalink
Merge pull request #219 from evanj/ignore-vendored-six
Browse files Browse the repository at this point in the history
Do not scan vendored copies of six.moves: Makes start faster
  • Loading branch information
spulec committed Mar 6, 2018
2 parents 7ad16a5 + 7af9f03 commit 590504c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions freezegun/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def start(self):
for mod_name, module in list(sys.modules.items()):
if mod_name is None or module is None:
continue
elif mod_name.startswith(self.ignore):
elif mod_name.startswith(self.ignore) or mod_name.endswith('.six.moves'):
continue
elif (not hasattr(module, "__name__") or module.__name__ in ('datetime', 'time')):
continue
Expand Down Expand Up @@ -469,7 +469,7 @@ def stop(self):
module = sys.modules.get(mod_name, None)
if mod_name is None or module is None:
continue
elif mod_name.startswith(self.ignore):
elif mod_name.startswith(self.ignore) or mod_name.endswith('.six.moves'):
continue
elif (not hasattr(module, "__name__") or module.__name__ in ('datetime', 'time')):
continue
Expand Down Expand Up @@ -535,7 +535,6 @@ def freeze_time(time_to_freeze=None, tz_offset=0, ignore=None, tick=False, as_ar
if ignore is None:
ignore = []
ignore.append('six.moves')
ignore.append('django.utils.six.moves')
ignore.append('threading')
ignore.append('Queue')
return _freeze_time(time_to_freeze, tz_offset, ignore, tick, as_arg)
Expand Down

0 comments on commit 590504c

Please sign in to comment.