Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix status label #141

Merged
merged 4 commits into from
Apr 10, 2020
Merged

Fix status label #141

merged 4 commits into from
Apr 10, 2020

Conversation

StefRe
Copy link
Contributor

@StefRe StefRe commented Apr 5, 2020

  • Fix status_label if no results to show
    status_label update is triggered by assignment of test results in
    process_finished. In case of no results, process_finished is called
    with an empty list of testresults. This empty list must also be
    assigned in order to trigger the status_label update, otherwise the
    status remains "Running tests ..." after finishing. So we have to
    differentiate between None and [] in the if clause.

    Without the fix it looks like this after running when no tests were discovered:
    grafik

  • Reset status_label when running tests is stopped
    and make parsing errors in unittestrunner.load_data indeed ignored silently
    (it relies on the condition that the result includes the final line of all
    dashes, otherwise an Indexerror will occur)

    Without the fix the status label "Running tests ..." remains visible after stopping
    the run.

status_label update is triggered by assignment of test results in
process_finished. In case of no results, process_finished is called
with an empty list of testresults. This empty list must also be
assigned in order to trigger the status_label update, otherwise the
status remains "Running tests ..." after finishing. So we have to
differentiate between None and [] in the if clause.
and make parsing errors in unittestrunner.load_data indeed ignored siently
(it relies on the condition that the result includes the final line of all
dashes, otherwise an Indexerror will occur)
@jitseniesen
Copy link
Member

* Fix status_label if no results to show

When I tried your PR, I didn't see any change here. If I use the plugin to run pytest in a directory with no tests, the label still shows "Running tests ..." after pytest is finished.

Further testing suggests this depends on the testing framework. If I use the unittest framework, then your fix does work correctly.

Could you please have a look? Which testing framework did you use? The way the pytest framework is handled in the plugin is a bit more complicated, so there is more scope for errors.

@jitseniesen
Copy link
Member

I forgot to say, thanks for your work and especially for including the tests!

and add integration test for all three test frameworks for this condition.
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@6372d86). Click here to learn what that means.
The diff coverage is n/a.

@StefRe
Copy link
Contributor Author

StefRe commented Apr 9, 2020

Oh - this is the problem when we don't have enough tests :). At first I wanted to add an integration test but then decided for just the unit test (test_unittestwidget_process_finished_updates_status_label).

So anyway I fixed it now and added a small integration test (test_run_with_no_tests_discovered_and_display_results) for all three test frameworks. Thanks for pointing it out to me.

@jitseniesen
Copy link
Member

Looks good now, this is going in. Thanks!

@jitseniesen jitseniesen merged commit 5736314 into spyder-ide:master Apr 10, 2020
@StefRe StefRe deleted the fix-status_label branch April 10, 2020 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants