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

override_dh_auto_test and custom system (for Django, for ex.) - Was: Was: Re: pybuild - one to rule^W build them all



Hi.

FWIW, I've tried and find a way to invoke the Django auto tests when
using debhelper and pybuild (i.e. running django-admin test in the build
dir).

I had noticed this mail describing the use of the 'custom' system and
--test-args, but it seems there's a better way :

override_dh_auto_test:
	PYBUILD_SYSTEM=custom \
        PYBUILD_TEST_ARGS="cd {build_dir}; django-admin test --settings=YOURMODULE.test_settings --pythonpath=. [YOURMODULE.tests]" \
	dh_auto_test

This should be more robust in the case where pybuild must be called
twice to run the tests with Python 2 and 3, AFAIU.

Sorry if this is obvious to elders, but I hadn't spotted that yet.

I have updated
https://wiki.debian.org/DjangoPackagingDraft#Running_auto_tests_at_build_time
accordingly.

Hope this helps.

Best regards,

Piotr Ożarowski <piotr@debian.org> writes:

>
>> 2. unit-testing against built/installed modules (if some env variable
>>    provides the command to be invoked)
>
> it already invokes `pythonX.Y setup.py test` (if "test_suite" string is
> detected in setup.py, distutils plugin only) or `pythonX.Y -m unittest
> discover -v` in all other cases, you also can:
>
> override_dh_auto_test:
> 	pybuild --test --system=custom --test-args 'cd {build_dir}; your command'
>

-- 
Olivier BERGER 
http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)


Reply to: