-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[py]: Propagate
stderr
to exceptions when selenium manager fails (#…
…11329) * [py]: Capture `stderr` when selenium manager goes wrong and some tests * [py]: Apply `linting` * [py]: tidy up `selenium manager` unit tests * [py]: Remove unused fixtures and improve naming of manager unit tests * [py] Raise `SeleniumManagerException` when binary cannot be found on disk * Delete py/selenium/webdriver/common/linux directory * [py]: Handle exceptions better in `service` classes from `selenium-manager` * [py]: Remove `selenium-manager` binary * [py]: simplify command and logging in selenium manager `.run()` * [py]: update `.gitignore` to prevent `selenium-manager` in python
- Loading branch information
Showing
6 changed files
with
70 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
35 changes: 35 additions & 0 deletions
35
py/test/selenium/webdriver/common/selenium_manager_tests.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Licensed to the Software Freedom Conservancy (SFC) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The SFC licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
import pytest | ||
|
||
from selenium.common.exceptions import SeleniumManagerException | ||
from selenium.webdriver.common.selenium_manager import SeleniumManager | ||
|
||
|
||
def test_non_supported_browser_raises_sme(): | ||
msg = r"foo is not a valid browser. Choose one of: \('chrome', 'firefox', 'edge', 'ie'\)" | ||
with pytest.raises(SeleniumManagerException, match=msg): | ||
_ = SeleniumManager().driver_location("foo") | ||
|
||
|
||
def test_stderr_is_propagated_to_exception_messages(): | ||
msg = "Selenium manager failed for.*Error: \"Invalid browser/driver name\"" | ||
with pytest.raises(SeleniumManagerException, match=msg): | ||
manager = SeleniumManager() | ||
binary = manager.get_binary() | ||
_ = manager.run((str(binary), "--browser", "foo")) |