diff --git a/docs/changelog.rst b/docs/changelog.rst index 8914028ea0..11bdb8aedf 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -12,6 +12,11 @@ Added - New ``before_add_examples`` hook. `#571`_ - New ``after_init_cli_run_handlers`` hook. `#575`_ +Fixed +~~~~~ + +- Passing ``workers_num`` to ``ThreadPoolRunner`` which lead to always using 2 workers in this worker kind. `#579`_ + `1.5.1`_ - 2020-05-08 --------------------- @@ -1040,6 +1045,7 @@ Fixed .. _0.3.0: https://github.com/kiwicom/schemathesis/compare/v0.2.0...v0.3.0 .. _0.2.0: https://github.com/kiwicom/schemathesis/compare/v0.1.0...v0.2.0 +.. _#579: https://github.com/kiwicom/schemathesis/issues/579 .. _#575: https://github.com/kiwicom/schemathesis/issues/575 .. _#571: https://github.com/kiwicom/schemathesis/issues/571 .. _#566: https://github.com/kiwicom/schemathesis/issues/566 diff --git a/src/schemathesis/runner/__init__.py b/src/schemathesis/runner/__init__.py index 6221898915..a955598316 100644 --- a/src/schemathesis/runner/__init__.py +++ b/src/schemathesis/runner/__init__.py @@ -188,6 +188,7 @@ def execute_from_schema( auth_type=auth_type, headers=headers, seed=seed, + workers_num=workers_num, request_timeout=request_timeout, exit_first=exit_first, store_interactions=store_interactions, diff --git a/test/runner/test_runner.py b/test/runner/test_runner.py index cf580ba60c..3d976567cb 100644 --- a/test/runner/test_runner.py +++ b/test/runner/test_runner.py @@ -15,7 +15,7 @@ from schemathesis.checks import content_type_conformance, response_schema_conformance, status_code_conformance from schemathesis.constants import USER_AGENT from schemathesis.models import Status -from schemathesis.runner import events, get_base_url, get_requests_auth, prepare +from schemathesis.runner import ThreadPoolRunner, events, get_base_url, get_requests_auth, prepare from schemathesis.runner.impl.core import get_wsgi_auth @@ -605,3 +605,11 @@ def test_reproduce_code_with_overridden_headers(args, base_url): else: expected = f"requests.get('{base_url}/api/failure', headers={headers})" assert after.result.checks[1].example.requests_code == expected + + +@pytest.mark.endpoints("success") +def test_workers_num_regression(mocker, schema_url): + # GH: 579 + spy = mocker.patch("schemathesis.runner.ThreadPoolRunner", wraps=ThreadPoolRunner) + execute(schema_url, workers_num=5) + assert spy.call_args[1]["workers_num"] == 5