Skip to content

Commit 214af58

Browse files
committed
test: use pytest-xdist to run on multiple cores in parallel
1 parent b9f678a commit 214af58

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

Makefile

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,43 @@ help:
77
target_dirs := tests TTS notebooks recipes
88

99
test: ## run tests.
10-
coverage run -m pytest -x -v --durations=0 tests
10+
pytest -x -v -n auto --durations=0 tests
1111

1212
test_vocoder: ## run vocoder tests.
13-
coverage run -m pytest -x -v --durations=0 tests/vocoder_tests
13+
pytest -x -v -n auto --durations=0 tests/vocoder_tests
1414

1515
test_tts: ## run tts tests.
16-
coverage run -m pytest -x -v --durations=0 tests/tts_tests
16+
pytest -x -v -n auto --durations=0 tests/tts_tests
1717

1818
test_tts2: ## run tts tests.
19-
coverage run -m pytest -x -v --durations=0 tests/tts_tests2
19+
pytest -x -v -n auto --durations=0 tests/tts_tests2
2020

2121
test_xtts:
22-
coverage run -m pytest -x -v --durations=0 tests/xtts_tests
22+
pytest -x -v -n auto --durations=0 tests/xtts_tests
2323

2424
test_aux: ## run aux tests.
25-
coverage run -m pytest -x -v --durations=0 tests/aux_tests
25+
pytest -x -v -n auto --durations=0 tests/aux_tests
2626
./run_bash_tests.sh
2727

2828
test_zoo0: ## run zoo tests.
29-
coverage run -m pytest -x -v --durations=0 tests/zoo_tests/test_models.py \
29+
pytest -x -v -n auto --durations=0 tests/zoo_tests/test_models.py \
3030
-k "test_models_offset_0_step_3 or test_voice_conversion"
3131
test_zoo1: ## run zoo tests.
32-
coverage run -m pytest -x -v --durations=0 tests/zoo_tests/test_models.py -k test_models_offset_1_step_3
32+
pytest -x -v -n auto --durations=0 tests/zoo_tests/test_models.py -k test_models_offset_1_step_3
3333
test_zoo2: ## run zoo tests.
34-
coverage run -m pytest -x -v --durations=0 tests/zoo_tests/test_models.py -k test_models_offset_2_step_3
34+
pytest -x -v -n auto --durations=0 tests/zoo_tests/test_models.py -k test_models_offset_2_step_3
3535

3636
inference_tests: ## run inference tests.
37-
coverage run -m pytest -x -v --durations=0 tests/inference_tests
37+
pytest -x -v -n auto --durations=0 tests/inference_tests
3838

3939
data_tests: ## run data tests.
40-
coverage run -m pytest -x -v --durations=0 tests/data_tests
40+
pytest -x -v -n auto --durations=0 tests/data_tests
4141

4242
test_text: ## run text tests.
43-
coverage run -m pytest -x -v --durations=0 tests/text_tests
43+
pytest -x -v -n auto --durations=0 tests/text_tests
4444

4545
test_failed: ## only run tests failed the last time.
46-
coverage run -m pytest --last-failed -v tests
46+
pytest --last-failed -v tests
4747

4848
style: ## update code style.
4949
uv run --only-dev black ${target_dirs}

pyproject.toml

+5
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ dev = [
139139
"coverage[toml]>=7",
140140
"pre-commit>=3",
141141
"pytest>=8",
142+
"pytest-cov>=6.0.0",
143+
"pytest-xdist[psutil]>=3.6.1",
142144
"ruff==0.7.0",
143145
]
144146
# Dependencies for building the documentation
@@ -242,3 +244,6 @@ source = ["TTS"]
242244
[tool.cibuildwheel]
243245
build = "cp*"
244246
skip = "*-win32 *i686 *musllinux*"
247+
248+
[tool.pytest.ini_options]
249+
addopts = "--cov=TTS"

0 commit comments

Comments
 (0)