On Wed, Sep 08, 2010 at 22:38 +0100, Floris Bruynooghe wrote:
> As you've probably noticed I've made a fork at
> http://bitbucket.org/flub/py-trunk-assert.  I've addressed these two
> points in it already, or so I hope.  I can't figure out how to
> properly test the plugin however, it either feels too brittle or too
> loose.  So any hints on how to test that sort of thing would be
> welcome.

The tests you added in 

http://bitbucket.org/flub/py-trunk-assert/src/c8e85f1f4adb/testing/plugin/test_pytest_assertion.py

look fine to me.  You could check for a bit more detail on some selected
examples but the main thing is to make sure that nothing blows up. 

Regarding the tests in 
http://bitbucket.org/flub/py-trunk-assert/src/c8e85f1f4adb/testing/code/test_assertionnew.py

i'd rather move them to the above plugin test module.  py/code is completely 
independent 
from py.test.  Speaking of it, in _assertionew.py your very call to 

    py.test.config.pytest_assert_compare() 

is problematic. ``py.test.config`` is a global access path that is never used 
internally.  Not too far off i'd like to get rid of ``py.test.config`` 
alltogether
or rather move it to a "pytest_compat" plugin which maintains some older
APIs/behaviours. 

For your branch, it means that the pytest_assertion plugin needs to parametrize 
the
assertion-machinery with a config/hook object. Maybe for now, we can just do 
something like:

    def pytest_configure(config):
        ...
            py.builtin.builtins.AssertionError._pytesthook = config.hook 

and check for and call through this attribute from _assertionnew.py.
This means that if one uses py/code without py.test then the latter
will be not be initialized/touched at all (accessing py.test.config triggers
default plugin loading and basic initialization). 

> Other then that I need to get on with implementing more and better
> default behaviour, at least cover everything unittest2 does.

Great, thanks.  
This looks all quite good.  Looking forward to use it myself soon :) 

best,
holger
_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to