Open tarekmokhtarjr opened 3 years ago
Hello @tarek-caesar
Instead of using an existing container, you might prefer to create a new container just to run pytest if you need your server online at the same time. Note that to run the tests you usually want to generate a new database in demo data mode.
If you use the docker-odoo-project
image you can use the tools testdb-gen
and testdb-update
for this before launching pytest
.
@yvaucher
Thanks for your answer, i will check that.
Hello I figured this out, I wrote an article to explain better how to run odoo's tests with pycharm, generate coverage reports and get debugging working, I hope this is useful for you: https://medium.com/plusteam/how-to-run-odoo-tests-with-pycharm-51e4823bdc59.
I included an example repository with some commands to set up a testing database, etc.
@tarek-caesar btw, you can run the tests in the same container you regularly use, you just need to specify a different port, like this:
pytest -s addons/<my_module>/tests/test_account_move.py --odoo-database=staging_3 -p 8001
You can use the param --no-http to run another instance without stopping odoo or exposing new ports
Hello guys,
first i would like to thank you for this awesome tool ! I'm running Odoo from docker container and what i did is the following :
docker exec -ti <my_odoo_container> bash
pip3 install pytest-odoo
pytest -s addons/<my_module>/tests/test_account_move.py --odoo-database=staging_3
But it gives me this error![image](https://user-images.githubusercontent.com/5776663/112128909-2aef2300-8bc7-11eb-9880-8bfb0c9321fa.png)
OSError: [Errno 98] Address already in use
:Did anyone encounter a similar issue ?
Thanks.