override_dh_auto_test and custom system (for Django, for ex.) - Was: Was: Re: pybuild - one to rule^W build them all
- To: debian-python@lists.debian.org
- Subject: override_dh_auto_test and custom system (for Django, for ex.) - Was: Was: Re: pybuild - one to rule^W build them all
- From: Olivier Berger <olivier.berger@telecom-sudparis.eu>
- Date: Fri, 06 Dec 2013 18:27:39 +0100
- Message-id: <[🔎] 87lhzx99f8.fsf_-_@inf-8660.int-evry.fr>
- In-reply-to: <20130120124147.GG10689@piotro.eu> ("Piotr Ożarowski"'s message of "Sun, 20 Jan 2013 13:41:47 +0100")
- References: <20130119171422.GD10689@piotro.eu> <20130120001606.GH19929@onerussian.com> <20130120124147.GG10689@piotro.eu>
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: