Hi Floris,

On Tue, Aug 14, 2012 at 23:41 +0100, Floris Bruynooghe wrote:
> Hello Holger,
> 
> I've started experimenting a bit more with the new resource api in
> pytest-django, I haven't got very far yet but do have already some
> feedback and questions.
> 
> Firstly my main issue, I don't know how to inspect the marks on the
> function/item in a function-scoped setup.  Looking at the code the
> only thing I could find was TestContext._resource.keywords and
> TestContext._resource.applymarker().  The latter which has an explicit
> comment saying it is unavailable on purpose.  The former almost
> exposed as TestContext.keywords but commented out.  So how do you use
> markers?  This should probably be documented as well.

Accessing and working with markers is missing - i only briefly touched
it during the implementation of the new resource API.  I intend to
have testcontext grow a "markers" dictionary, mapping mark names to 
lists of MarkInfo objects.

You can currently work-around/hack using testcontext._request._pyfuncitem.obj
as a reference to the underlying test function.

> Secondly the docs should probably show how to do teardown in an @setup
> function.  I think it would be nice to show an example of scope and
> teardown before going into the global resource example.  Related to
> this TestContext.addfinalizer() is not documented in the TestContext
> API docs.  Probably because autodoc doesn't pick it up.  Maybe simply
> merging TestContextRequest into TestContext is enough?
> TestContextSetup would not need any changes to keep it's behaviour in
> that case.

Makes all sense i think.

> Next something I have mentioned before, marking a pytest_funcarg__foo
> function with @factory seems to sill give an incomprehensible error.
> Personally I think it should be possible and "consume" the funcarg
> just like @setup consumes e.g. setup_module(), but if I'm alone in
> that a clearer error would be good improvement.

Agreed, i'll see to lopok into it.

> Another thing which surprised me was that @pytest.setup() needs to be
> called in order to have any effect.  Not calling the decorator will
> simply ignore the setup function, I expected it to treat it as a
> function-scoped setup.

I wasn't quite sure if to mimick the current pytest.mark behaviour
of allowing usage with and without "()".  While trying to write
a docstring for it i thought it's maybe better to allow just one way.
But there definitely should be some clear error

best,
holger

> 
> Regards,
> Floris
> _______________________________________________
> py-dev mailing list
> py-dev@codespeak.net
> http://codespeak.net/mailman/listinfo/py-dev
> 
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to