[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#802839: django-celery: python 3 tests not invoked and break



Robert Collins <robertc@robertcollins.net> writes:

> I'd probably shut that warning up using the warnings module API rather
> than weaking the test more broadly.

Might be the best thing.

> Also - track down and file a bug on the leak source.

How *do* you track these down? The warning doesn't say where the file
was opened.

Anyway, I suspect the problem is with the call to imp.find_module(),
which is a depreciated function in Python 3.4:

It ends with:

   file = open(file_path, mode, encoding=encoding)
   return file, file_path, (suffix, mode, type_)

djcelery.loaders.find_related_module() calls this function and ignores
the result. Which obviously means the file doesn't get closed.

    try:
        imp.find_module(related_name, app_path)
    except ImportError:
        return

    return importlib.import_module('{0}.{1}'.format(app, related_name))
    
Need to think about if it is worth fixing, and what the best fix is.
-- 
Brian May <bam@debian.org>


Reply to: