import pytest from PyQt5 import QtCore import os from nixview.ui.mainwindow import NixView test_file = os.path.join(".", "nix_test.h5") @pytest.fixture def app(qtbot): if not os.path.exists(test_file): from nixview.test.create_test_file import create_test_file create_test_file() test_nv = NixView() qtbot.addWidget(test_nv) return test_nv def test_file_open(app, qtbot): assert not app._file_handler.is_valid app.open_file(test_file) assert app._file_handler.is_valid assert app._help_action.isEnabled() def test_file_handler(app): assert app._file_handler.is_valid assert not app._plot_action.isEnabled() assert not app._table_action.isEnabled() assert app._file_handler._entity_buffer is not None assert app._file_handler.file_descriptor is not None