# How to test a module in Tryton

**URL:** https://discuss.tryton.org/t/how-to-test-a-module-in-tryton/5424
**Category:** Developer
**Created:** [July 19, 2022, 12:01pm UTC](https://discuss.tryton.org/t/how-to-test-a-module-in-tryton/5424 "2022-07-19T12:01:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![edbo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/e/f14d63/32.png) [@edbo](https://discuss.tryton.org/u/edbo)
#### Post date: [July 19, 2022, 12:01pm UTC](https://discuss.tryton.org/t/how-to-test-a-module-in-tryton/5424/1 "2022-07-19T12:01:30Z")

</div>

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

```auto
/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?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [July 19, 2022, 12:11pm UTC](https://discuss.tryton.org/t/how-to-test-a-module-in-tryton/5424/2 "2022-07-19T12:11:08Z")

</div>

Since [Remove usage of setup.py test (#9215) · Issues · Tryton / Tryton · GitLab](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:

```auto
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.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [July 19, 2022, 12:54pm UTC](https://discuss.tryton.org/t/how-to-test-a-module-in-tryton/5424/3 "2022-07-19T12:54:39Z")

</div>

More information on [Testing — Tryton server](https://docs.tryton.org/projects/server/en/latest/topics/testing.html)

---

<div class="post-metadata">

### Author: ![edbo](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/e/f14d63/32.png) [@edbo](https://discuss.tryton.org/u/edbo)
#### Post date: [July 19, 2022, 2:11pm UTC](https://discuss.tryton.org/t/how-to-test-a-module-in-tryton/5424/4 "2022-07-19T14:11:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [August 18, 2022, 2:11pm UTC](https://discuss.tryton.org/t/how-to-test-a-module-in-tryton/5424/5 "2022-08-18T14:11:59Z")

</div>

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