It looks like the auto-refresh function tries to reload the notebooks and blocks the file so the teardown-function can't delete it. We either have to delay the teardown or we have to disable the auto-refresh completely in the test-environment
trace:
============================= test session starts =============================
platform win32 -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.2 -- C:\Program Files\Python34\python.exe
qt-api: pyside
rootdir: C:\_Programmierung\noteorganiser\fork\NoteOrganiser, inifile:
plugins: cov, mock, qt
collected 18 items
noteorganiser/tests/test_frames.py::test_custom_frame PASSED
noteorganiser/tests/test_frames.py::test_library PASSED
noteorganiser/tests/test_frames.py::test_shelves PASSED
noteorganiser/tests/test_frames.py::test_text_editor PASSED
noteorganiser/tests/test_frames.py::test_text_editor ERROR
noteorganiser/tests/test_frames.py::test_editing PASSED
noteorganiser/tests/test_frames.py::test_editing ERROR
noteorganiser/tests/test_frames.py::test_preview PASSED
noteorganiser/tests/test_main_window.py::test_initialisation PASSED
noteorganiser/tests/test_text_processing.py::test_full_file PASSED
noteorganiser/tests/test_text_processing.py::test_tag_sorting PASSED
noteorganiser/tests/test_text_processing.py::test_extract_tags_from_post PASSED
noteorganiser/tests/test_text_processing.py::test_is_valid_post PASSED
noteorganiser/tests/test_text_processing.py::test_extract_corpus_from_post PASSED
noteorganiser/tests/test_text_processing.py::test_extract_title_from_post PASSED
noteorganiser/tests/test_text_processing.py::test_extract_date_from_post PASSED
noteorganiser/tests/test_text_processing.py::test_normalize_post PASSED
noteorganiser/tests/test_text_processing.py::test_post_to_markdown PASSED
noteorganiser/tests/test_utils.py::test_fuzzySearch PASSED
noteorganiser/tests/test_widgets.py::test_LineEditWithClearButton PASSED
=================================== ERRORS ====================================
____________________ ERROR at teardown of test_text_editor ____________________
item = <Function 'test_text_editor'>
@pytest.mark.hookwrapper
def pytest_runtest_teardown(item):
"""
Hook called after each test tear down, to process any pending events and
avoiding leaking events to the next test.
"""
yield
app = QApplication.instance()
if app is not None:
if _exception_capture_disabled(item):
app.processEvents()
else:
with capture_exceptions() as exceptions:
app.processEvents()
if exceptions:
> pytest.fail('TEARDOWN ERROR: ' + format_captured_exceptions(exceptions))
E Failed: TEARDOWN ERROR: Qt exceptions in virtual methods:
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\second.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\second.md'
E ________________________________________________________________________________
C:\Program Files\Python34\lib\site-packages\pytestqt\plugin.py:604: Failed
-------------------------- Captured stderr teardown ---------------------------
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\second.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\second.md'
______________________ ERROR at teardown of test_editing ______________________
item = <Function 'test_editing'>
@pytest.mark.hookwrapper
def pytest_runtest_teardown(item):
"""
Hook called after each test tear down, to process any pending events and
avoiding leaking events to the next test.
"""
yield
app = QApplication.instance()
if app is not None:
if _exception_capture_disabled(item):
app.processEvents()
else:
with capture_exceptions() as exceptions:
app.processEvents()
if exceptions:
> pytest.fail('TEARDOWN ERROR: ' + format_captured_exceptions(exceptions))
E Failed: TEARDOWN ERROR: Qt exceptions in virtual methods:
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\second.md'
E ________________________________________________________________________________
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
E self.loadText()
E File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
E errors='replace').read()
E
E FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
E ________________________________________________________________________________
C:\Program Files\Python34\lib\site-packages\pytestqt\plugin.py:604: Failed
-------------------------- Captured stderr teardown ---------------------------
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\second.md'
Traceback (most recent call last):
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1046, in autoRefresh
self.loadText()
File "C:\_Programmierung\noteorganiser\fork\NoteOrganiser\noteorganiser\frames.py", line 1000, in loadText
errors='replace').read()
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\tobias.ARCUS\\.noteorganiser\\.test_2015-08-07\\example.md'
It looks like the auto-refresh function tries to reload the notebooks and blocks the file so the teardown-function can't delete it. We either have to delay the teardown or we have to disable the auto-refresh completely in the test-environment
trace: