[py-dev] Resource providers

Floris Bruynooghe flub at devork.be
Mon Jun 25 16:21:42 CEST 2012


On 25 June 2012 14:29, holger krekel <holger at merlinux.eu> wrote:
> On Mon, Jun 25, 2012 at 10:55 +0100, Floris Bruynooghe wrote:
>> The concrete example I have now is that it could be nice in
>> pytest-django to be able to request e.g. "Users" which is a model
>> class used to access the User table in the database.  Currently this
>> is only possible by someone explicitly defining pytest_funcarg__Users,
>> but Django allows you to dynamically look up all the models in the
>> database so there is no reason this can't be build automatically.
>>
>> I think this is what the API you proposed was for, but as I said I
>> can't remember the details.  And in this case I might be less
>> enthusiastic in postponing it's implementation to a later release ;-)
>
> It's probably true that we could invent an register-factory API for this.
>
> However, what about a single "models" object (done traditionally
> with a pytest_funcarg__models definition) which itself provides
> an API to give "Users" or others data?

Yes of course, that is what I currently have in my conftest.py.  But
it would still be a nice thing to be able to do and a nice example of
functionality I have wished I had before.  Hence I was wondering if
the API you talked about yesterday would support it.


Floris

-- 
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org



More information about the Pytest-dev mailing list