pytest-dev / pytest-xdist

pytest plugin for distributed testing and loop-on-failures testing modes.
https://pytest-xdist.readthedocs.io
MIT License
1.46k stars 232 forks source link

View output in jenkins #294

Open Formartha opened 6 years ago

Formartha commented 6 years ago

Hi,

I'm using xdist in our automation - however, it seems like xdist doesn't throttle the tests correctly in the console. How can we view the current state (which tests run and when)?

example :

14:47:56 14:47:56 ############################# 14:47:56 # Starting to run the tests # 14:47:56 ############################# 14:47:56 14:47:56 Tests are running with XDIST - stay tuned 14:47:56 Loading .env environment variables… 14:47:56 ============================= test session starts ============================== 14:47:56 platform linux2 -- Python 2.7.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0 14:47:56 rootdir: /, inifile: 14:47:56 plugins: xdist-1.22.2, pylint-0.9.0, metadata-1.7.0, html-1.17.0, forked-0.2, cov-2.5.1 14:47:57 gw0 I / gw1 I 14:47:58 gw0 [21] / gw1 [21] 14:47:58 14:47:58 scheduling tests via LoadScheduling

** after the last line - it seems like the job is working but nothing is being exported.

Thanks, M

nicoddemus commented 6 years ago

Try passing -v to pytest, this way pytest will print one test per line and probably provide a better feedback.

Formartha commented 6 years ago

works like a charm. however, how can I remove the print out of the working worker?

for example :

./../../testsuite/integration/ncso/authorization/test_ncso_invalid_login.py::test_ncso_invalid_login 
15:29:19 ../../../testsuite/integration/aai/test_aai_ncso_adapter_add_topology.py::TestAaiNcsoAdapterTopologyAdd::test_ncso_adapter_ncso_topoolgy 
15:29:19 [gw1] [  4%] PASSED ../../../testsuite/integration/ncso/authorization/test_ncso_invalid_login.py::test_ncso_invalid_login 
15:29:21 ../../../testsuite/integration/ncso/operability/test_ncso_enable_plugin_not_exist_negative.py::test_ncso_enable_plugin_not_exist_negative 
15:29:21 [gw0] [  9%] FAILED ../../../testsuite/integration/aai/test_aai_ncso_adapter_add_topology.py::TestAaiNcsoAdapterTopologyAdd::test_ncso_adapter_ncso_topoolgy 
15:29:21 ../../../testsuite/integration/ncso/data_store/test_4469_gds_crud.py::test_4469_GDS_CRUD 
15:29:21 [gw0] [ 14%] PASSED ../../../testsuite/integration/ncso/data_store/test_4469_gds_crud.py::test_4469_GDS_CRUD 
15:29:22 ../../../testsuite/integration/ncso/operability/test_ncso_load_plugin_negative.py::test_ncso_load_plugin_negative 
15:29:22 [gw1] [ 19%] PASSED ../../../testsuite/integration/ncso/operability/test_ncso_enable_plugin_not_exist_negative.py::test_ncso_enable_plugin_not_exist_negative 
15:29:24 ../../../testsuite/integration/red_wire/test_integration_sdc_ncso_aai_site_csar.py::test_integration_sdc_ncso_aai_site_csar 
15:29:24 [gw0] [ 23%] PASSED ../../../testsuite/integration/ncso/operability/test_ncso_load_plugin_negative.py::test_ncso_load_plugin_negative 
15:31:01 ../../../testsuite/integration/red_wire/test_integration_sdc_ncso_aai_vpn_csar.py::test_integration_sdc_ncso_aai_vpn_csar 
15:31:01 [gw1] [ 28%] FAILED ../../../testsuite/integration/red_wire/test_integration_sdc_ncso_aai_site_csar.py::test_integration_sdc_ncso_aai_site_csar 
15:33:59 ../../../testsuite/integration/red_wire/test_integration_sdc_ncso_aai_subscriber_vmd_csar.py::test_integration_sdc_ncso_aai_subscriber_vmd_csar 
15:33:59 [gw0] [ 33%] PASSED ../../../testsuite/integration/red_wire/test_integration_sdc_ncso_aai_vpn_csar.py::test_integration_sdc_ncso_aai_vpn_csar 
15:37:13 ../../../testsuite/integration/sdc/test_sdcnew-135_certify_service_which_was_certified_and_updated.py::test_sdcnew_135_certify_service_which_was_certified_and_updated 
15:37:13 [gw0] [ 38%] PASSED ../../../testsuite/integration/sdc/test_sdcnew-135_certify_service_which_was_certified_and_updated.py::test_sdcnew_135_certify_service_which_was_certified_and_updated 
15:37:42 ../../../testsuite/integration/sdc/test_sdcnew-14_create_service_with_valid_csar_and_user.py::test_SDCNEW_14_create_service_with_valid_csar_and_user 
15:37:42 [gw0] [ 42%] PASSED ../../../testsuite/integration/sdc/test_sdcnew-14_create_service_with_valid_csar_and_user.py::test_SDCNEW_14_create_service_with_valid_csar_and_user 
15:37:48 ../../../testsuite/integration/sdc/test_sdcnew-15_create_service_with_invalid_csar_file.py::test_SDCNEW_15_create_service_with_invalid_csar 
15:37:48 [gw0] [ 47%] PASSED ../../../testsuite/integration/sdc/test_sdcnew-15_create_service_with_invalid_csar_file.py::test_SDCNEW_15_create_service_with_invalid_csar 
15:37:51 ../../../testsuite/integration/sdc/test_sdcnew-16_create_service_with_non_exists_user.py::test_SDCNEW_16_create_service_with_non_exists_user 
15:37:51 [gw0] [ 52%] PASSED ../../../testsuite/integration/sdc/test_sdcnew-16_create_service_with_non_exists_user.py::test_SDCNEW_16_create_service_with_non_exists_user

I dont want to see the lines where a worker picked up something, just to view it's state :)

nicoddemus commented 6 years ago

There's not an option for that, I'm afraid. TBH I think the line that indicates which worker picked up a test is very useful.

Formartha commented 6 years ago

The line of the worker is perfect, howver - you can see that what is being picked up is not listed down on which worker (until is passed or failed)

nicoddemus commented 6 years ago

Hmm indeed, my bad, I could swear we printed the worker also when the test got picked up...

Formartha commented 6 years ago

@nicoddemus - that could be a quick addon that will come handy :)