← Back to team overview

openerp-community team mailing list archive

Re: Asserting exceptions in yaml tests

 

Le 01/09/2011 17:05, Olivier Dony a écrit :
On 08/28/2011 02:19 PM, Georges Racinet wrote:
After a quick search on launchpad, and a code read, I couldn't find much
on the matter of cleanly make assertions about exceptions in Yaml tests.

To say it quickly, I'm thinking of an analog of unittest's assertRaises
(http://docs.python.org/library/unittest.html#unittest.TestCase.assertRaises)

You're right, there's currently no provision for assertRaises-like tests
in YAML, except via a custom !python block with a try/except, as you noted.

I get odd behaviours after a try: except: block in a !python directive in YAML. I think this kind of test is not even possible, and I suspect the test transaction is rolled-back anyway during the exception so that subsequent tests cannot be done :(

Christophe




In any case, if that's something really missing in the yaml testing
framework, I'd be glad to blueprint and implement it (although a
backport to 6.0 branch would be our primary interest)

That would certainly be a welcome contribution! The chance of seeing it
merged in 6.0 are low however, as the stable branches policy restricts
allowed patches to bugfixes only.
That said, it could be merged in trunk and thus part of the upcoming
6.1, and nothing prevents you to run your own yaml-patched 6.0 server
for your 6.0 developments, until you decide to move on to 6.1. You'd
still have the guarantee that those tests would be ready for 6.1.

As for shaping up such a blueprint, may I suggest the mailing-list of
the framework experts team
(https://launchpad.net/~openerp-expert-framework) as an appropriate
place to discuss it?

_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openerp-community
More help   : https://help.launchpad.net/ListHelp




Follow ups

References