odoo-ide/pycharm-odoo

Not recognizing tests when project is in WSL2

Azgaroth1554 opened this issue · 12 comments

When opening a project in WSL2 with Pycharm on Windows, the plugin doesn't seem to recognize tests and isn't parsing the results correctly either.

Issue appears in every version of Odoo from 14 until 17 (didn't test previous versions)

Capture d'écran 2023-12-19 063626 Capture d'écran 2023-12-19 063841

Hello @Azgaroth1554 ,

I could not reproduce the problem. Can you help me check if the problem also occurs for tests in the Odoo source code? E.g.:

image

Hello @trinhanhngoc did you try it with a project that is in the files of the WSL2 machine? Note that I'm using Pycharm in Windows with WSL2 interpreter and code that is in the WSL2 machine not on Windows.

I'm having the same issue with Odoo

Capture d'écran 2023-12-19 084025

@Azgaroth1554 , I haven't tried with WSL2 yet. Can you try with a test in the Odoo source code, then take a screenshot and copy the console output for me?

@trinhanhngoc Sure, here is the console output (note that I only have the issue with WSL2, outside of it the plugin works perfectly)

/home/odoo/16.0/venv/bin/python /home/odoo/16.0/odoo/odoo-bin -d 16.0 --addons-path /home/odoo/16.0/odoo/addons,/home/odoo/16.0/enterprise --test-tags /product:TestPricelist.test_10_discount --stop-after-init 
Testing started at 09:21 ...
2023-12-19 08:04:22,127 172860 INFO ? odoo: Odoo version 16.0
2023-12-19 08:04:22,127 172860 INFO ? odoo: addons paths: ['/home/odoo
/16.0/odoo/odoo/addons', '/home/odoo/.local/share/odoo/add
ons/16.0', '/home/odoo/16.0/odoo/addons', '/home/odoo/16.0/enterprise']
2023-12-19 08:04:22,127 172860 INFO ? odoo: database: default@default:default
2023-12-19 08:04:22,372 172860 INFO ? odoo.addons.base.models.ir_actions_report:
 Will use the Wkhtmltopdf binary at /usr/bin/wkhtmltopdf
2023-12-19 08:04:22,814 172860 INFO ? odoo.service.server: HTTP service (werkzeu
g) running on localhost:8069
2023-12-19 08:04:22,869 172860 INFO 16.0 odoo.modules.loading: loading 1 modules
...
2023-12-19 08:04:23,010 172860 INFO 16.0 odoo.modules.loading: 1 modules loaded
in 0.14s, 0 queries (+0 extra)
2023-12-19 08:04:23,087 172860 INFO 16.0 odoo.modules.loading: loading 80 module
s...
2023-12-19 08:04:24,503 172860 INFO 16.0 odoo.modules.loading: 80 modules loaded
 in 1.42s, 0 queries (+0 extra)
2023-12-19 08:04:24,646 172860 INFO 16.0 odoo.modules.loading: Modules loaded.
2023-12-19 08:04:24,655 172860 INFO 16.0 odoo.modules.registry: Registry loaded
in 1.842s
2023-12-19 08:04:24,655 172860 INFO 16.0 odoo.service.server: Starting post test
s
2023-12-19 08:04:25,084 172860 INFO 16.0 odoo.addons.product.tests.test_pricelis
t: Starting TestPricelist.test_10_discount ...
2023-12-19 08:04:25,195 172860 INFO 16.0 odoo.addons.base.models.ir_attachment:
filestore gc 1 checked, 0 removed
2023-12-19 08:04:25,195 172860 INFO 16.0 odoo.service.server: 1 post-tests in 0.
54s, 159 queries
2023-12-19 08:04:25,196 172860 INFO 16.0 odoo.tests.stats: product: 3 tests 0.44
s 159 queries
2023-12-19 08:04:25,196 172860 INFO 16.0 odoo.tests.result: 0 failed, 0 error(s)
 of 1 tests when loading database '16.0'
2023-12-19 08:04:25,196 172860 INFO 16.0 odoo.service.server: Initiating shutdow
n
2023-12-19 08:04:25,196 172860 INFO 16.0 odoo.service.server: Hit CTRL-C again o
r send a second signal to force the shutdown.
2023-12-19 08:04:25,478 172860 INFO 16.0 odoo.sql_db: ConnectionPool(used=0/coun
t=0/max=64): Closed 1 connections

@Azgaroth1554 , I noticed that your console logs are wrapped, e.g.:

2023-12-19 08:04:25,084 172860 INFO 16.0 odoo.addons.product.tests.test_pricelis
t: Starting TestPricelist.test_10_discount ...

The normal log should look like this:

2023-12-19 08:04:25,084 172860 INFO 16.0 odoo.addons.product.tests.test_pricelist: Starting TestPricelist.test_10_discount ...

Can you check if the wrapping is related to WSL2?

@trinhanhngoc Indeed I've also noticed that strange wrapping. When running it through the WSL2 terminal there's no wrapping so I don't think WSL2 is the issue here (but I might be mistaken). What is strange also is that when running Odoo in Pycharm, there's no wrapping of the lines even though I'm using the Odoo configuration.

While searching for the issue on Pycharm, I've noticed that another plugin had the same issue (lines wrapped at 80 chars) I don't know if that might help https://youtrack.jetbrains.com/issue/RIDER-64288/Run-console-output-line-wrapping-options

@Azgaroth1554 , I am also searching for similar issues on https://youtrack.jetbrains.com.

What is strange also is that when running Odoo in Pycharm, there's no wrapping of the lines even though I'm using the Odoo configuration.

Do you mean the wrapping just occurs with the test run configuration but not with the normal run configuration?

@trinhanhngoc Yes that's what I mean

@Azgaroth1554 I think I need to buy a new Windows machine to figure out a solution for this problem :)

Update: I just reproduced the problem on my Windows 11 with WSL 1.

Hello @Azgaroth1554 ,

The new version 2024.1.1 has been released to address this issue.