You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes the test_uses_edgedriver_logging test in py/test/selenium/webdriver/edge/edge_service_tests.py.
Previously, this test was failing because it was attempting to launch 2 browsers using the same Service object. This is not possible and results in an error:
E selenium.common.exceptions.SessionNotCreatedException: Message: session not created
E from unknown error: cannot find msedge binary
This PR creates 2 Service objects so each driver instance can use its own.
🔄 Types of changes
Bug fix (backwards compatible)
PR Type
Bug fix
Description
Fixed failing test_uses_edgedriver_logging in Edge service tests.
Replaced single Service object with two separate instances.
Ensured proper cleanup of driver instances and log file.
Changes walkthrough 📝
Relevant files
Bug fix
edge_service_tests.py
Fix Edge logging test with separate Service instances
Using the same log file for both service instances can lead to race conditions and unpredictable test results. Create unique log files for each service to ensure proper isolation.
Why: Using separate log files for each service would prevent potential race conditions and make the test more reliable. This is a valid concern as concurrent writes to the same log file could lead to unpredictable test behavior.
Medium
Check file exists before removal
The test will fail if the log file doesn't exist when attempting to remove it. Add a check to verify the file exists before trying to delete it.
finally:
if driver1:
driver1.quit()
if driver2:
driver2.quit()
- os.remove(log_file)+ if os.path.exists(log_file):+ os.remove(log_file)
Apply this suggestion
Suggestion importance[1-10]: 6
__
Why: Adding a check for file existence before removal prevents potential FileNotFoundError exceptions if the log file wasn't created for some reason. This improves error handling and makes the test more robust.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
💥 What does this PR do?
This is a fix to the internal Python test suite.
This PR fixes the test_uses_edgedriver_logging test in py/test/selenium/webdriver/edge/edge_service_tests.py.
Previously, this test was failing because it was attempting to launch 2 browsers using the same Service object. This is not possible and results in an error:
This PR creates 2 Service objects so each driver instance can use its own.
🔄 Types of changes
PR Type
Bug fix
Description
Fixed failing
test_uses_edgedriver_loggingin Edge service tests.Replaced single
Serviceobject with two separate instances.Ensured proper cleanup of driver instances and log file.
Changes walkthrough 📝
edge_service_tests.py
Fix Edge logging test with separate Service instancespy/test/selenium/webdriver/edge/edge_service_tests.py
Serviceobject with two separate instances.driver1to avoid potential errors.