Closed naught101 closed 4 years ago
I think it would work to still use the decorator but make the test function async (async def test_helloworld…
) and replace the inner yield
with await
.
Am 15. August 2019 02:34:51 MESZ schrieb naught101 notifications@github.com:
Following the Readme, I get this:
tests/test_helloworld.py:23: PytestWarning: yield tests were removed in pytest 4.0 - test_helloworld will be ignored @pytest.mark.gen_test
Any idea what I can do to replace it? All I need to test is a single call to a tornado websocket API.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/eugeniy/pytest-tornado/issues/56
@naught101 I tried the example from the readme and do net get such a message.
Could you show your code and what versions of pytest-tornado and pytest you are using?
Sorry for the delay. I get this error when I clone this repo, and run pytest
in it.
$ pytest
============================================== test session starts ===============================================
platform linux -- Python 3.6.10, pytest-4.3.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/nedcr/Downloads/source_code/pytest-tornado, inifile:
plugins: profiling-1.7.0, tornasync-0.6.0.post2, cov-2.6.1, repeat-0.8.0
collected 43 items
test/test_async.py ...xx.xxxX.xx [ 30%]
test/test_async_await.py .. [ 34%]
test/test_fixtures.py xx. [ 41%]
test/test_https_support.py xEEE [ 51%]
test/test_param.py ....x......xxx [ 83%]
test/test_server.py .EExxxE [100%]
===================================================== ERRORS =====================================================
___________________________ ERROR at setup of test_base_url_is_https_with_https_client ___________________________
file /home/nedcr/Downloads/source_code/pytest-tornado/test/test_https_support.py, line 39
def test_base_url_is_https_with_https_client(https_client, base_url):
E fixture 'https_client' not found
> available fixtures: LineMatcher, __pytest_repeat_step_number, _pytest, anypython, app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, http_client, http_server, http_server_client, http_server_port, io_loop, linecomp, monkeypatch, no_cover, pytestconfig, record_property, record_xml_attribute, recwarn, ssl_options, testdir, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/nedcr/Downloads/source_code/pytest-tornado/test/test_https_support.py:39
____________________________ ERROR at setup of test_base_url_is_https_with_https_port ____________________________
file /home/nedcr/Downloads/source_code/pytest-tornado/test/test_https_support.py, line 44
def test_base_url_is_https_with_https_port(https_port, base_url):
E fixture 'https_port' not found
> available fixtures: LineMatcher, __pytest_repeat_step_number, _pytest, anypython, app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, http_client, http_server, http_server_client, http_server_port, io_loop, linecomp, monkeypatch, no_cover, pytestconfig, record_property, record_xml_attribute, recwarn, ssl_options, testdir, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/nedcr/Downloads/source_code/pytest-tornado/test/test_https_support.py:44
___________________________ ERROR at setup of test_base_url_is_https_with_https_server ___________________________
file /home/nedcr/Downloads/source_code/pytest-tornado/test/test_https_support.py, line 49
def test_base_url_is_https_with_https_server(https_server, base_url):
E fixture 'https_server' not found
> available fixtures: LineMatcher, __pytest_repeat_step_number, _pytest, anypython, app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, http_client, http_server, http_server_client, http_server_port, io_loop, linecomp, monkeypatch, no_cover, pytestconfig, record_property, record_xml_attribute, recwarn, ssl_options, testdir, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/nedcr/Downloads/source_code/pytest-tornado/test/test_https_support.py:49
_______________________________________ ERROR at setup of test_http_client _______________________________________
file /home/nedcr/Downloads/source_code/pytest-tornado/test/test_server.py, line 41
def test_http_client(http_client, base_url):
E fixture 'base_url' not found
> available fixtures: LineMatcher, __pytest_repeat_step_number, _pytest, anypython, app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, http_client, http_server, http_server_client, http_server_port, io_loop, linecomp, monkeypatch, no_cover, pytestconfig, record_property, record_xml_attribute, recwarn, testdir, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/nedcr/Downloads/source_code/pytest-tornado/test/test_server.py:41
______________________________ ERROR at setup of test_http_client_with_fetch_helper ______________________________
file /home/nedcr/Downloads/source_code/pytest-tornado/test/test_server.py, line 50
def test_http_client_with_fetch_helper(http_client, base_url):
E fixture 'base_url' not found
> available fixtures: LineMatcher, __pytest_repeat_step_number, _pytest, anypython, app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, http_client, http_server, http_server_client, http_server_port, io_loop, linecomp, monkeypatch, no_cover, pytestconfig, record_property, record_xml_attribute, recwarn, testdir, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/nedcr/Downloads/source_code/pytest-tornado/test/test_server.py:50
________________________________ ERROR at setup of test_base_url_default_is_http _________________________________
file /home/nedcr/Downloads/source_code/pytest-tornado/test/test_server.py, line 73
def test_base_url_default_is_http(base_url):
E fixture 'base_url' not found
> available fixtures: LineMatcher, __pytest_repeat_step_number, _pytest, anypython, app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, http_client, http_server, http_server_client, http_server_port, io_loop, linecomp, monkeypatch, no_cover, pytestconfig, record_property, record_xml_attribute, recwarn, testdir, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/nedcr/Downloads/source_code/pytest-tornado/test/test_server.py:73
================================================ warnings summary ================================================
test/test_async.py:32
test/test_async.py:32: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test will be ignored
@pytest.mark.gen_test
test/test_async.py:38
test/test_async.py:38: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test_run_sync_false will be ignored
@pytest.mark.gen_test(run_sync=False)
test/test_async.py:50
test/test_async.py:50: PytestWarning: yield tests were removed in pytest 4.0 - test_generator_raises will be ignored
@pytest.mark.gen_test
test/test_async.py:57
test/test_async.py:57: PytestWarning: yield tests were removed in pytest 4.0 - test_explicit_gen_test_marker will be ignored
@pytest.mark.gen_test
test/test_async.py:63
test/test_async.py:63: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test_marker_with_params will be ignored
@pytest.mark.gen_test(timeout=2.1)
test/test_async.py:69
test/test_async.py:69: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test_with_timeout will be ignored
@pytest.mark.xfail(raises=TimeoutError)
test/test_async.py:80
test/test_async.py:80: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test will be ignored
@pytest.mark.gen_test
test/test_async.py:85
test/test_async.py:85: PytestWarning: yield tests were removed in pytest 4.0 - test_generator_raises will be ignored
@pytest.mark.gen_test
test/test_fixtures.py:23
test/test_fixtures.py:23: PytestWarning: yield tests were removed in pytest 4.0 - test_uses_pytestmark_fixtures will be ignored
@pytest.mark.xfail(pytest.__version__ < '2.7.0',
test/test_fixtures.py:35
test/test_fixtures.py:35: PytestWarning: yield tests were removed in pytest 4.0 - test_uses_pytestmark_fixtures will be ignored
@pytest.mark.gen_test
test/test_https_support.py:33
test/test_https_support.py:33: PytestWarning: yield tests were removed in pytest 4.0 - test_hello_world will be ignored
@pytest.mark.gen_test
test/test_param.py:51
test/test_param.py:51: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test_parametrize will be ignored
@pytest.mark.gen_test
test/test_param.py:61
test/test_param.py:61: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test_fixture_any_order will be ignored
@pytest.mark.parametrize('input,expected', [
test/test_param.py:71
test/test_param.py:71: PytestWarning: yield tests were removed in pytest 4.0 - test_gen_test_param_fixture will be ignored
@pytest.mark.gen_test
test/test_server.py:55
test/test_server.py:55: PytestWarning: yield tests were removed in pytest 4.0 - test_http_client_with_gen_test will be ignored
@pytest.mark.gen_test
test/test_server.py:61
test/test_server.py:61: PytestWarning: yield tests were removed in pytest 4.0 - test_get_url_with_path will be ignored
@pytest.mark.gen_test
test/test_server.py:67
test/test_server.py:67: PytestWarning: yield tests were removed in pytest 4.0 - test_http_client_raises_on_404 will be ignored
@pytest.mark.gen_test
-- Docs: https://docs.pytest.org/en/latest/warnings.html
===================== 19 passed, 17 xfailed, 1 xpassed, 17 warnings, 6 error in 0.99 seconds =====================
My library version:
$ pip freeze|grep "\(pytest\|tornado\)"
pytest==5.4.3
pytest-cov==2.6.1
pytest-profiling==1.7.0
pytest-repeat==0.8.0
pytest-tornado==0.8.1
pytest-tornasync==0.6.0.post2
tornado==6.0.1
I get this error when I clone this repo, and run
pytest
in it.
It looks like you didn't install the package from the cloned repository?
Typically you would install it with pip install -e .
if you plan to work on the code.
I get the same errors if I install that way.
Strange. When installed correctly, it should show up in the "plugins" list printed by pytest at the start of the run (e.g. form latest CI: plugins: tornado-0.8.1
). In your output it says plugins: profiling-1.7.0, tornasync-0.6.0.post2, cov-2.6.1, repeat-0.8.0
.
Maybe there is an issue with you environment? Some tips to debug could be to run which pytest
and which pip
, and ensure they are all working towards the same Python environment. You could try creating a new environment as well?
I found this strange aswell.
One thing that did stick out in @naught101 s pytest env info is pytest-tornasync
.
Once I install this the tests break for me aswell.
@naught101 does it work for you if you remove the pytest-tornasync
plugin from your environment?
Yes, removing pytest-tornasync seems to have fixed the problem. Thanks for the help :)
Following the Readme, I get this:
Any idea what I can do to replace it? All I need to test is a single call to a tornado websocket API.