spulec / freezegun

Let your Python tests travel through time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`extend_ignore_list` should add ignore package only once

lleontop opened this issue · comments

Hi,

when configuring freezegun to extend the ignore list with extend_ignore_list there isn't any check if the same package(s) already exist in the list with the result that multiple invocations with the same parameter(s) cause the list to include multiple duplicates.

example code:

>>> freezegun.configure(extend_ignore_list=['pymongo'])
>>> freezegun.configure(extend_ignore_list=['pymongo'])
>>> freezegun.config.settings.default_ignore_list
['nose.plugins', 'six.moves', 'django.utils.six.moves', ..., 'gi', 'pymongo', 'pymongo']

I think either checking for existence or using a set for a list could solve this. I can create a PR for that if you agree!

Thanks!

That makes sense @lleontop - PR's are welcome!