Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Test: Accelerate pytests with some parallelisation #70

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

mawildoer
Copy link
Contributor

@mawildoer mawildoer commented Sep 22, 2024

Speed-up ~2x in total time

New

====================================================================================================== test session starts ======================================================================================================
platform darwin -- Python 3.12.3, pytest-8.3.3, pluggy-1.5.0
rootdir: /Users/mattwildoer/Projects/faebryk-wt1
configfile: pyproject.toml
plugins: xdist-3.6.1
8 workers [547 items]   
......................................................................................................................................................................................................................... [ 39%]
......................................................................................................................................................................................................................... [ 79%]
....................................................................ss..........sssssssss...s....s...............                                                                                                         [100%]
======================================================================================================= warnings summary ========================================================================================================
test/libs/test_lcsc.py: 275 warnings
  /Users/mattwildoer/Projects/faebryk-wt1/.venv/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py:293: PydanticDeprecatedSince20: The `__fields__` attribute is deprecated, use `model_fields` instead. Depr
ecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.9/migration/                                                                                                         warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================== 534 passed, 13 skipped, 275 warnings in 44.03s =========================================================================================
pytest -n auto  96.68s user 12.70s system 246% cpu 44.310 total

Old

====================================================================================================== test session starts ======================================================================================================
platform darwin -- Python 3.12.3, pytest-8.3.3, pluggy-1.5.0
rootdir: /Users/mattwildoer/Projects/faebryk-wt1
configfile: pyproject.toml
collected 547 items                                                                                                                                                                                                             

test/core/test_core.py .....                                                                                                                                                                                              [  0%]
test/core/test_hierarchy_connect.py .....                                                                                                                                                                                 [  1%]
test/core/test_parameters.py ........                                                                                                                                                                                     [  3%]
test/core/test_performance.py ...                                                                                                                                                                                         [  3%]
test/core/test_traits.py .......                                                                                                                                                                                          [  5%]
test/core/test_util.py .                                                                                                                                                                                                  [  5%]
test/exporters/netlist/kicad/test_netlist_kicad.py .                                                                                                                                                                      [  5%]
test/exporters/pcb/kicad/test_transformer.py .                                                                                                                                                                            [  5%]
test/importers/netlist/kicad/test_schematic_kicad.py s                                                                                                                                                                    [  5%]
test/integration/netlist/kicad2faebryk/test_netlist_kicad_2_faebryk_prj.py s                                                                                                                                              [  6%]
test/library/nodes/test_electricpower.py .                                                                                                                                                                                [  6%]
test/library/test_basic.py .............................................................................................................................................................................................. [ 40%]
......................................................................................................................................................................................................................... [ 80%]
....................................................................                                                                                                                                                      [ 93%]
test/library/test_footprints.py ..                                                                                                                                                                                        [ 93%]
test/library/test_names.py .                                                                                                                                                                                              [ 93%]
test/library/test_reference.py ......                                                                                                                                                                                     [ 94%]
test/libs/kicad/test_fileformats.py ..........                                                                                                                                                                            [ 96%]
test/libs/picker/test_jlcpcb.py ssssssssss                                                                                                                                                                                [ 98%]
test/libs/test_e_series.py ...                                                                                                                                                                                            [ 98%]
test/libs/test_lcsc.py .                                                                                                                                                                                                  [ 99%]
test/libs/test_util.py ....                                                                                                                                                                                               [ 99%]
test/libs/test_util_atexit.py s                                                                                                                                                                                           [100%]

======================================================================================================= warnings summary ========================================================================================================
test/libs/test_lcsc.py: 275 warnings
  /Users/mattwildoer/Projects/faebryk-wt1/.venv/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py:293: PydanticDeprecatedSince20: The `__fields__` attribute is deprecated, use `model_fields` instead. Depre
cated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.9/migration/                                                                                                           warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=================================================================================== 534 passed, 13 skipped, 275 warnings in 86.34s (0:01:26) ====================================================================================
pytest  75.35s user 9.12s system 95% cpu 1:28.70 total

@mawildoer
Copy link
Contributor Author

Seems like we only see a very very mild improvement on the CI runners, because they're done on machines with only 2 CPUs, but it's still an improvement and locally it's vastly better!

Copy link
Contributor

@iopapamanoglou iopapamanoglou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!
I made it also run locally in parallel.
Seems to work:
image

@mawildoer mawildoer merged commit 50967f8 into main Sep 23, 2024
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants