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

[6.15.z] browser teardown fix at session exit #1413

Conversation

pnovotny
Copy link
Contributor

@pnovotny pnovotny commented Jun 3, 2024

Cherrypick of PR: #1390

Problem Statement

When nesting airgun.session.Session in multiple context managers (like robottelo session fixture does),
the __exit__ method, which handles browser teardown, is called mutliple times as well.

This causes that the second and further attempt to call webdriver.quit() will fail,
because the browser was already closed.

Solution

Execute the browser teardown only once.

Related Issues

Needed for SatelliteQE/robottelo#15050

The browser teardown in `airgun.session.Session.__exit__` should be executed only once.

Because when `Session` is nested in multiple context managers(*),
the `__exit__` method is called for each one
and this causes that the second and further `webdriver.quit()` call will fail,
because the browser session was already stopped.

(*) for example in the robottelo `session` fixture in `robottelo/pytest_fixtures/core/ui.py`.
@pnovotny pnovotny added 6.13.z AutoMerge_Cherry_Picked Automatically merge the PR is PRT and all checks are passing 6.14.z labels Jun 3, 2024
@pnovotny pnovotny self-assigned this Jun 3, 2024
@pnovotny pnovotny added 6.16.z CherryPick PR needs CherryPick to previous branches labels Jun 3, 2024
@omkarkhatavkar omkarkhatavkar merged commit 6b6423e into SatelliteQE:6.15.z Jun 3, 2024
10 of 15 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 3, 2024
The browser teardown in `airgun.session.Session.__exit__` should be executed only once.

Because when `Session` is nested in multiple context managers(*),
the `__exit__` method is called for each one
and this causes that the second and further `webdriver.quit()` call will fail,
because the browser session was already stopped.

(*) for example in the robottelo `session` fixture in `robottelo/pytest_fixtures/core/ui.py`.

(cherry picked from commit 6b6423e)
github-actions bot pushed a commit that referenced this pull request Jun 3, 2024
The browser teardown in `airgun.session.Session.__exit__` should be executed only once.

Because when `Session` is nested in multiple context managers(*),
the `__exit__` method is called for each one
and this causes that the second and further `webdriver.quit()` call will fail,
because the browser session was already stopped.

(*) for example in the robottelo `session` fixture in `robottelo/pytest_fixtures/core/ui.py`.

(cherry picked from commit 6b6423e)
omkarkhatavkar pushed a commit that referenced this pull request Jun 3, 2024
The browser teardown in `airgun.session.Session.__exit__` should be executed only once.

Because when `Session` is nested in multiple context managers(*),
the `__exit__` method is called for each one
and this causes that the second and further `webdriver.quit()` call will fail,
because the browser session was already stopped.

(*) for example in the robottelo `session` fixture in `robottelo/pytest_fixtures/core/ui.py`.

(cherry picked from commit 6b6423e)

Co-authored-by: Pavel Novotny <[email protected]>
omkarkhatavkar pushed a commit that referenced this pull request Jun 3, 2024
The browser teardown in `airgun.session.Session.__exit__` should be executed only once.

Because when `Session` is nested in multiple context managers(*),
the `__exit__` method is called for each one
and this causes that the second and further `webdriver.quit()` call will fail,
because the browser session was already stopped.

(*) for example in the robottelo `session` fixture in `robottelo/pytest_fixtures/core/ui.py`.

(cherry picked from commit 6b6423e)

Co-authored-by: Pavel Novotny <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.13.z 6.14.z AutoMerge_Cherry_Picked Automatically merge the PR is PRT and all checks are passing CherryPick PR needs CherryPick to previous branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants