Closed sobolevn closed 6 years ago
So, on disabled flag --verbose
usual testing took ~25
second (without pytest-xdist
) and I thinks that is not a bad result.
As for mypy
, then:
without pytest-xdist
:
py.test --mypy mimesis/
================================================================= test session starts =================================================================
platform linux -- Python 3.5.2, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/likid/Development/open_source/mimesis, inifile: pytest.ini
plugins: forked-0.2, xdist-1.20.1, cov-2.5.1, mypy-0.3.0, flake8-0.8.1, mock-1.6.3
collected 101 items
============================================================ 101 passed in 399.73 seconds =============================================================
on the single core:
py.test -n 1 --mypy mimesis/
================================================================= test session starts =================================================================
platform linux -- Python 3.5.2, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/likid/Development/open_source/mimesis, inifile: pytest.ini
plugins: forked-0.2, xdist-1.20.1, cov-2.5.1, mypy-0.3.0, flake8-0.8.1, mock-1.6.3
gw0 [101]
scheduling tests via LoadScheduling
.....................................................................................................
============================================================ 101 passed in 356.98 seconds =============================================================
on the 2 cores:
py.test -n 2 --mypy mimesis/
================================================================= test session starts =================================================================
platform linux -- Python 3.5.2, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/likid/Development/open_source/mimesis, inifile: pytest.ini
plugins: forked-0.2, xdist-1.20.1, cov-2.5.1, mypy-0.3.0, flake8-0.8.1, mock-1.6.3
gw0 [101] / gw1 [101]
scheduling tests via LoadScheduling
.....................................................................................................
============================================================ 101 passed in 232.25 seconds =============================================================
Oh, mypy
takes so much time? From 25 seconds to almost 400 seconds?
How many CPU cores do you have? I usually set -n
to 4
to leverage all my cores.
@sobolevn On using with pytest-mypy
, on using just mypy
it works very fast. Less than 10 seconds.
@sobolevn I have used flag -n auto
and it's detected 4 cores automatically.
@lk-geimfari did not know about auto
. Could you create a PR with this fix for https://github.com/wemake-services/wemake-django-template please?
So, why won't we just run them separately? mypy
first, then pytest
?
@sobolevn I think so too. I'll fix it. What worries me, since Travis CI understands that the tests were successful? If we will use just mypy, without pytest, then how Travis understand that type check is passed?
@sobolevn Do you mean auto
for wemake-django-template
? Do you use pytest-xdist
, because I can't find it in Pipfile
.
So, it's done. We'll use just mypy
, not pytest-mypy
. It works fine!
Fixed in #299
Please, don't forget to fix https://github.com/wemake-services/wemake-django-template/blob/master/%7B%7Bcookiecutter.project_name%7D%7D/setup.cfg#L37 Thanks!
@sobolevn Also Travis provides CPU with 2 cores, not 4.
Right now tests take more than 7 minutes. https://github.com/lk-geimfari/mimesis/issues/263#issuecomment-347634658
What do I suggest:
pytest-xdist