Closed rvalyi closed 6 years ago
The setup.py
is generated by setuptools-odoo-make-default
, but this setup.py
is meant to be modified manually. setuptools Odoo just adds keywords it can discover/compute from the manifest. So you are free to add tests_requires
in setup.py if you want to.
:-1: to autopopulate setup.py from odoo manifest keys, though.
That said, as you noted, you need a test runner that would supports tests_require, which we don't have for Odoo. BTW, I'm not sure which test runners support test_requires. I think it's setuptools test
and nothing else. tests_require is also not propagated to packages metadata. In regular python projects I personally don't use it as I prefer tox, and therefore declare test dependencies in tox.ini.
So all in all I don't think setuptools-odoo can help with this.
A better test framework for Odoo is high on my wish list though. https://pypi.org/project/pytest-odoo/ is quite nice. I which it would be integrated in core Odoo.
Hum ok thanks. Then I guess the best is to just put it inside the external_dependency keyword even if it sub-optimal. I guess Odoo core does no better when it has packages like mock into its requirement.txt file anyway...
Yep...
Hello @sbidoul, recently for Shopinvader we started using vcrpy to speed up tests for the payment_gateway_stripe module for instance. So the vcrpy Python package is required to run the tests (but only for the tests). From what I understand, in setup.py there is the ´´´tests_require´´´ special keyword to support this (see https://setuptools.readthedocs.io/en/latest/setuptools.html?highlight=tests_require#new-and-changed-setup-keywords )
However I don't see how I can control this keyword value in the generated setup.py. Should we add this keyword support into this generator? What about the other setup.py keyword? Can we not just say any supported setup.py keyword will be copied from the ´´´manifest.py´´´ to the generated setup.py? And finally even if setuptools-odoo would support tests_require, will the OCA testing infrastructure use it at all to fetch the dependency before running the tests? Thanks.
cc @sebastienbeau