django-wiki / django-nyt

Notification system for Django with batteries included: Email digests, user settings, JSON API
Apache License 2.0
144 stars 47 forks source link

cache not being cleared when testing #42

Closed timeyyy closed 6 years ago

timeyyy commented 7 years ago

When testing with django's TestCase, after a test django is successfuly deleting all database entries. However this function is not being called.

@receiver([post_save, post_delete], sender=NotificationType)
def clear_notification_type_cache(*args, **kwargs):
    global _notification_type_cache
    print('CLEARNING NOTIFICATION TYPE CACHE', len(_notification_type_cache))
    _notification_type_cache = {}

Calling this function manually works great to fix my tests, i'm not sure if there is a bug lurking around though...

timeyyy commented 6 years ago

covered by https://github.com/benjaoming/django-nyt/issues/34