On 13 May 14:11, Sergi Almacellas Abellana wrote:
> El 13/05/14 13:48, Mathias Behrle ha escrit:
> >* Cédric Krier: " [tryton-dev] Test and dependecies" (Mon, 12 May 2014 
> >17:28:35
> >   +0200):
> >
> >>>There is a problem with the new tests added to purchase (see
> >>>http://tests.tryton.org/~test/postgresql.html).
> >>>The test fails when running with account_stock_continental because this
> >>>module add a constraint on product account stock.
> >>>
> >>>I wrote a patch:http://codereview.tryton.org/13311003
> >>>but I'm not sure it is the right way to go.
> >>>An other possibility would be to remove the required of
> >>>account_stock_continental for bad design reason (there are still the
> >>>*_used which raise error message).
> >>>
> >>>What do you think?
> >What about testing in tests/test_purchase.py, if module
> >account_stock_continental is installed and just in case provide the needed
> >values?
> So if i develop module XX (which is not part of core modules) and adds
> another required field on product, I will need to add test in
> test_purchase.py (which is a core module) in order to get the test pass, so
> core modules must know about all the existing modules? IMHO this is not the
> right way.
> 
> Why not making test extensible as done on core modules in order to get other
> modules add the needed configuration to run the test. So basically this will
> be:
> 
> class ProductTestCase():
> 
>     def create_test_product():
>         'creates a product for running the test'
> 
> class PurchaseTestCase():
> 
>     def test0010XXXX():
>         product = create_test_product()
> 
> class AccountStockContinental()
> 
>     def create_test_product():
>         super()
>         set_configuration
> 
>     def test0010XXX():
>         product = create_test_product()
> 
> Thoughts?

Tests are about testing code. If you always tests with the same value,
you don't cover all possibles cases.
required fields should be set carefully as exlpained in previous email.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Attachment: pgprDNF2EJOSS.pgp
Description: PGP signature

Reply via email to