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

Re: Python < 3.5 tests



On Thu, 8 Oct 2015 at 22:44 Dmitry Shachnev <mitya57@debian.org> wrote:

There was a change in unittest autoloader in Python 3.5. It now tries to
import the package even if it has no tests. I do not know if it is an
intended change, or a side-effect of fixing some bug ([1]?). Maybe Robert
can enlighten us here.

Right. I think somebody else said the same thing, however I didn't understand how it could be related.

My (unproven) theory is it is importing ajax_select/__init__.py, which in turn loads Django files, which in turn fail because Django is not initialized.

I seem to have this problem regularly. What is a good way of initializing Django for the tests? My latest technique - IIRC - create a wrapper python code for the the tests, and called it debian/run_tests.py - along with a debian/test_settings.py file - is this the best way?

Example:

http://anonscm.debian.org/viewvc/python-modules/packages/djangorestframework/trunk/debian/run_tests.py?revision=33810&view=markup

http://anonscm.debian.org/viewvc/python-modules/packages/djangorestframework/trunk/debian/test_settings.py?revision=33810&view=markup


 
This has caused some my packages to FTBFS too, for example see bugs
#800671 and #800139. So if it not an intended change, it should be fixed
upstream.

[1] http://bugs.python.org/issue22457


I just noticed #800137 - I think I have seen this exact same problem here too.

Reply to: