We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Sorry if something is wrong, I just started to learn automatic testing, and I'm sorry, I'm not English speaking. Here is my code:
def button_start_clicked(self): try: vertices_count = int(self.line_edit_count_vertices.text()) if vertices_count < 5: raise ValueError except ValueError: QMessageBox.warning(self, "header", "text", QMessageBox.Close, QMessageBox.Close)
The problem is that the QMessageBox does not close. Please explain how to test this code correctly.
Here is my simple test
@pytest.mark.parametrize("value", [4, 5, "text"]) def test_button_start_clicked(value): window = Window() window.line_edit_count_vertices.setText(str(value)) window.button_start_clicked()
UPD after 30 minutes of thinking: here is my simple solution, but I think that it is not perfect
application = QApplication() @pytest.mark.parametrize("value", [4, 5, "text"]) def test_button_start_clicked(self, value): def close_window(): sleep(0.5) if type(application.activeWindow()) is QMessageBox: application.activeWindow().accept() window = Window() window.line_edit_count_vertices.setText(str(value)) ThreadPoolExecutor().submit(close_window) window.button_start_clicked()
The text was updated successfully, but these errors were encountered:
Sorry if something is wrong, I just started to learn automatic testing, and I'm sorry, I'm not English speaking.
Don't worry! Your English is fine 😄
There are some ideas about this in #256 and in the docs: https://pytest-qt.readthedocs.io/en/latest/note_dialogs.html
Sorry, something went wrong.
Don't worry Google Translate 😄
Thanks for the links provided.
No branches or pull requests
Sorry if something is wrong, I just started to learn automatic testing, and I'm sorry, I'm not English speaking.
Here is my code:
The problem is that the QMessageBox does not close.
Please explain how to test this code correctly.
Here is my simple test
UPD after 30 minutes of thinking:
here is my simple solution, but I think that it is not perfect
The text was updated successfully, but these errors were encountered: