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 ResourceWarnings from test suite. #326

Merged
merged 2 commits into from
Jul 13, 2018
Merged

Conversation

mdickinson
Copy link
Member

On Python 3.6, there are ResourceWarnings due to unclosed files reported by the test suite. For example:

test_capture_errors_on_error (pyface.ui.qt4.util.tests.test_modal_dialog_tester.TestModalDialogTester) ... /Users/mdickinson/.edm/envs/pyface-test-3.6-pyqt/lib/python3.6/site-packages/pyface-6.1.0.dev13-py3.6.egg/pyface/ui/qt4/util/tests/test_modal_dialog_tester.py:143: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='w' encoding='UTF-8'>
  tester.open_and_run(when_opened=raise_error)
ok
test_capture_errors_on_failure (pyface.ui.qt4.util.tests.test_modal_dialog_tester.TestModalDialogTester) ... /Users/mdickinson/.edm/envs/pyface-test-3.6-pyqt/lib/python3.6/site-packages/pyface-6.1.0.dev13-py3.6.egg/pyface/ui/qt4/util/tests/test_modal_dialog_tester.py:124: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='w' encoding='UTF-8'>
  tester.open_and_run(when_opened=failure)
ok

This PR fixes (at least some of) those warnings.

@corranwebster
Copy link
Contributor

LGTM

@@ -54,28 +54,39 @@ def delete_widget(widget, timeout=1.0):
raise AssertionError(msg.format(widget))


@contextmanager
def _convert_none_to_null_handle(stream):
""" If 'stream' is not None, provide a temporary handle to /dev/null. """
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra "not" in this docstring that shouldn't be there.

@codecov-io
Copy link

codecov-io commented Jul 13, 2018

Codecov Report

Merging #326 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #326      +/-   ##
==========================================
+ Coverage   24.65%   24.67%   +0.02%     
==========================================
  Files         455      455              
  Lines       25549    25554       +5     
  Branches     3851     3850       -1     
==========================================
+ Hits         6298     6306       +8     
+ Misses      18939    18938       -1     
+ Partials      312      310       -2
Impacted Files Coverage Δ
pyface/ui/qt4/util/testing.py 67.69% <100%> (+7.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b00601...e15ecf6. Read the comment docs.

@mdickinson mdickinson merged commit 02e2826 into master Jul 13, 2018
@mdickinson mdickinson deleted the fix/resource-warnings branch July 13, 2018 12:27
@mdickinson
Copy link
Member Author

@corranwebster Thanks! Merging in spite of the fact that you haven't approved the last commit ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants