How to test a module in Tryton

I know there are other discussion here about testing, but none of them are working for me. I always get

/home/tryton/trytond_trunk_env/bin/python: No module named trytond.tests.run-tests

I cloned the repository into /home/trytond/trytond_trunk_env and used that also as the virtual environment. With the environment activated I installed trytond with python setup.py install. The same for the module I want to test (in this case ldap_authentication). Then back at the ‘root’ of the environment I issued python -m trytond.tests.run-tests -m ldap_authentication. But I always get the error message above.

As nobody else has this problem, I’m doing something wrong. Who pushes me into the right direction?

Since https://bugs.tryton.org/issue9215 which landed in 6.4 series we use unitest.discover to run tests suite.

You can run the test suite with the following command:

python -m unittest discover -s trytond.modules.ldap_authentication.tests 

Just make sure to update the ldap_authentication module with the name of the module you want to run the tests in case you want to run the tests of a diferent one.

More information on Testing — trytond latest documentation

1 Like

Thanks! After that I got a lot of errors because of different modules missing packages. As it seems all the modules were linked into modules directory of Trytond. Removing them except the needed module(s), did the trick.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.