Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The issue of pytest conflicting with kaldifst #61

Open
frznkshn opened this issue Apr 22, 2024 · 2 comments
Open

The issue of pytest conflicting with kaldifst #61

frznkshn opened this issue Apr 22, 2024 · 2 comments

Comments

@frznkshn
Copy link

Hi,

When I import pytest with kaldifst in a code repository and execute the command python3 run_test.py, it seems like the program gets stuck in a loop and doesn't return any result, nor does it give any errors. I would appreciate your opinion on what to do next. It appears that pytest has an issue with kaldifst—and generally with C++ Python wrappers.

# run_test.py

import kaldifst
import pytest

# Run pytest with coverage and generate reports
pytest.main(['--cov', '--cov-report', 'term', '--cov-report', 'xml:coverage.xml'])

What is shown in the terminal

===================================================================== test session starts =====================================================================
platform linux -- Python 3.8.16, pytest-7.4.4, pluggy-1.3.0
rootdir: /home
plugins: cov-4.1.0, hypothesis-6.92.2, hydra-core-1.1.2
collecting 1190 items
@csukuangfj
Copy link
Collaborator

it seems like the program gets stuck in a loop and doesn't return any result,

What is the expected result if you remove import kaldifst?

Does it work if you replace

import kaldifst

with

import numpy

or with

import torch

?

@frznkshn
Copy link
Author

frznkshn commented Apr 22, 2024

it seems like the program gets stuck in a loop and doesn't return any result,

What is the expected result if you remove import kaldifst?

Does it work if you replace

import kaldifst

with

import numpy

or with

import torch

?

Yes - When we replace kaldifst with numPy or torch or ..., the problem is resolved (a result is returned as the output of the test). Note that the program I'm trying to test coverage on includes several modules. I realized that pytest has issues running it, and after conducting investigations, I found that the problem lies with this Python wrapper. Then, I created a simple script as described above and found that even in this simple scenario, the program doesn't execute.

When we replace it with NumPy, we get such an output:

===================================================================== test session starts =====================================================================
platform linux -- Python 3.8.16, pytest-7.4.4, pluggy-1.3.0
rootdir: /home
plugins: cov-4.1.0, hypothesis-6.92.2, hydra-core-1.1.2
collected 1226 items / 3 errors
.
.
.
=================================================================== short test summary info ===================================================================
ERROR num2words/tests/test_cli.py
ERROR pyannote-audio-3.1/tests/test_run_notebooks.py
ERROR pyannote-audio-3.1/tests/tasks/test_reproducibility.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================================== 4 warnings, 3 errors in 21.63s ================================================================  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants