Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: Speed of the tests in v8

by
n.schmitt
- 01/21/2016 17:44:57
I have looked at your example with odoo_nose_anybox_example.
Everything works fine, at least your example.

Now I am trying to use this in my setup.

After some time, I have been able to enter the shell.
But so far, I have had no luck with running only one test file.

Issuing a nose.run(), I get kicked out with a:
>>> import nose
>>> nose.run()
Usage: odoo.py [options]
odoo.py: error: no such option: --addons-path

I also tried a nose.run(argv=[]).
There the tests seem to be running, but all the tests of the
applications, including the ones from Odoo. So it gives me a lot of
errors.

Would you happen to know how I may run the tests of only one file?
I will keep trying tomorrow.

Thanks for your help,
-- 
Nicolas Schmitt
Coordinador del Departamento de Tecnología e Información
PROTELCOTELSA SA
On 21/01/16, Nicolas Schmitt wrote:
> Sorry, I had not seen your post before answering.
> 
> I will have a look in your link.
> 
> Thank you very much!
> -- 
> Nicolas Schmitt
> Coordinador del Departamento de Tecnología e Información
> PROTELCOTELSA SA
> On 21/01/16, Leonardo Pistone wrote:
> > Here you have an example to the buildout+nose way:
> > https://github.com/lepistone/odoo_nose_anybox_example
> > As I said, you should be able to get similar results without buildout,
> > making a wrapper script that uses the "odoo shell" (available in v9
> > https://github.com/odoo/odoo/blob/9.0/openerp/cli/shell.py and
> > backported to v8 in an OCA module). I'm interested if you do that!
> > On Thu, Jan 21, 2016 at 5:56 PM, Nicolas Schmitt
> > <n.schmitt@protelcotelsa.com> wrote:
> > > Hi Leonardo,
> > >
> > > thanks for the quick answer.
> > >
> > > So far I am not using buildout, but I will certainly give it a look.
> > >
> > > About the unmerged PR, it seems really nice, but I guess it will be a
> > > bit hard to backport it to v8.
> > > Moreover there has been no activity for the last six months.
> > > I will have a look at it, to see if I can adapt it.
> > >
> > > I'll keep you updated on my findings.
> > > --
> > > Nicolas Schmitt
> > > Coordinador del Departamento de Tecnología e Información
> > > PROTELCOTELSA SA
> > > On 21/01/16, Leonardo Pistone wrote:
> > >> Hi!
> > >> a few things already exist:
> > >> - the anybox recipe can generate wrappers to run scripts that will be
> > >> able to import openerp with all the modules loaded correctly. In the
> > >> doc of the recipe you should find an example for nose. That way you
> > >> have all the options of nose (including running only one test, or the
> > >> one that failed). Moreover, there is no module update. Test output is
> > >> printed directly and it is not messed up by the odoo logging system,
> > >> which is also great. This works with existing unittests.
> > >> If you don't use the anybox recipe, in v8/v9 you should be able to run
> > >> something similar to the "odoo shell" (i.e. load the modules and
> > >> create en environment and a registry) and then run your tests with
> > >> nose or something like that.
> > >> - Xavier Morel worked on this unmerged PR:
> > >> https://github.com/odoo/odoo/pull/7759
> > >> On Thu, Jan 21, 2016 at 5:22 PM, Nicolas Schmitt
> > >> <n.schmitt@protelcotelsa.com> wrote:
> > >> > Hi all,
> > >> >
> > >> > Abstract
> > >> > ========
> > >> > I am using Odoo v8, and I am looking for a way to speed up the python
> > >> > unit testing.
> > >> > When I work on a test case on a module with many dependent modules,
> > >> > testing takes too much time (around 17 seconds).
> > >> >
> > >> > What I would like
> > >> > ============================
> > >> > The possibility to test only one file, even though it may require
> > >> > updating the module.
> > >> >
> > >> > What I would really like
> > >> > =========================
> > >> > The possibility to use --test-file= without having to
> > >> > update anything.
> > >> >
> > >> > What I have discovered so far
> > >> > ==============================
> > >> > 1) My tests are working all right using:
> > >> > ./openerp-server -c -d --test-enable
> > >> >  -u
> > >> > 2) I have many errors using:
> > >> > ./openerp-server -c -d --test-file=
> > >> > 3) I have the same errors using:
> > >> > ./openerp-server -c -d --test-file=
> > >> >  -u
> > >> >
> > >> > References
> > >> > ==========
> > >> > The only thing I could find so far is this post by Alexandre Fayolle
> > >> > from 2013, without any answer:
> > >> >
> > >> > https://www.odoo.com/fr_FR/forum/help-1/question/why-does-the-test-file-argument-run-tests-in-no-update-mode-18669
> > >> > It is really similar to my problem, only that it seems to apply only to
> > >> > yaml files, and that the Odoo version seems not to be the 8th.
> > >> >
> > >> > The ultimate goal
> > >> > =================
> > >> > With the possibility to run only one test file, I would like to
> > >> > implement a way to trigger automatically the testing on model/views/test
> > >> > files
> > >> > modifications (maybe using watchdog?).
> > >> >
> > >> > Conclusion
> > >> > ==========
> > >> > If you know the answer to this particular problem, or if you have any
> > >> > kind of tips about facilitating testing, I would be grateful for your
> > >> > input.
> > >> > Also if you know things specific to Odoo 9, still good to know.
> > >> > I will then sum up all solutions/tips in an Odoo Forums post, so that it
> > >> > may serve to others.
> > >> _______________________________________________
> > >> Mailing-List: https://www.odoo.com/groups/community-framework-62 [1]
> > >> Post to: mailto:expert-framework@mail.odoo.com
> > >> Unsubscribe: https://www.odoo.com/groups?unsubscribe [2]
> > >>
> > >>
> > >>
> > >> [1] https://www.odoo.com/groups/community-framework-62
> > >> [2] https://www.odoo.com/groups?unsubscribe
> > >
> > > _______________________________________________
> > > Mailing-List: https://www.odoo.com/groups/community-framework-62
> > > Post to: mailto:expert-framework@mail.odoo.com
> > > Unsubscribe: https://www.odoo.com/groups?unsubscribe
> > _______________________________________________
> > Mailing-List: https://www.odoo.com/groups/community-framework-62 [1]
> > Post to: mailto:expert-framework@mail.odoo.com
> > Unsubscribe: https://www.odoo.com/groups?unsubscribe [2]
> > 
> > 
> > 
> > [1] https://www.odoo.com/groups/community-framework-62
> > [2] https://www.odoo.com/groups?unsubscribe
>