Brian May <b...@debian.org> writes: > ====================================================================== > FAIL: test_discovery_with_broken (djcelery.tests.test_discovery.TestDiscovery) > ---------------------------------------------------------------------- > Traceback (most recent call last): > File > "/home/brian/tree/debian/python-modules/django-celery/tests/../djcelery/tests/test_discovery.py", > line 45, in test_discovery_with_broken > self.assertEqual(log, []) > AssertionError: Lists differ: [<warnings.WarningMessage object at > 0x7f2b03474c88>] != [] > > First list contains 1 additional elements. > First extra element 0: > {message : ResourceWarning("unclosed file <_io.TextIOWrapper > name='/home/brian/tree/debian/python-modules/django-celery/tests/someapp/tasks.py' > mode='r' encoding='utf-8'>",), category : 'ResourceWarning', filename : > '/home/brian/tree/debian/python-modules/django-celery/tests/../djcelery/loaders.py', > lineno : 204, line : None} > > - [<warnings.WarningMessage object at 0x7f2b03474c88>] > + [] > > ---------------------------------------------------------------------- > Ran 66 tests in 0.340s > > FAILED (errors=2, failures=1)
That includes a debug message I put in. Oops. Showing the warning object that caused the problem. It seems that Python3 is generating an unexpected error ("unclosed file") that is upsetting the test because it expects 0 warnings. Any ideas how to fix this? It doesn't appear to be this project that is producing the warning, maybe that comes from Django. Or should I just remove the Assert? The code in question that appears to be producing the warning: def autodiscover(): """Include tasks for all applications in ``INSTALLED_APPS``.""" global _RACE_PROTECTION if _RACE_PROTECTION: return _RACE_PROTECTION = True try: if django.VERSION < (1, 7): return filter(None, [find_related_module(app, 'tasks') for app in settings.INSTALLED_APPS]) else: from django.apps import apps return filter(None, [find_related_module(app.name, 'tasks') for app in apps.get_app_configs()]) finally: _RACE_PROTECTION = False This is in git, in the expected python-modules location. -- Brian May <b...@debian.org>