Skip to content

Commit c2df7f4

Browse files
committed
Refactor some code
1 parent f06dbce commit c2df7f4

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

seleniumbase/fixtures/shared_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
from selenium.common.exceptions import NoSuchElementException
99
from selenium.common.exceptions import NoSuchFrameException
1010
from selenium.common.exceptions import NoSuchWindowException
11-
from seleniumbase.common.exceptions import NoSuchFileException
12-
from seleniumbase.common.exceptions import TimeLimitExceededException
1311
from seleniumbase import config as sb_config
1412

1513

1614
def format_exc(exception, message):
1715
"""
1816
Formats an exception message to make the output cleaner.
1917
"""
18+
from seleniumbase.common.exceptions import NoSuchFileException
19+
2020
if exception == Exception:
2121
exc = Exception
2222
return exc, message
@@ -65,6 +65,8 @@ def _format_message(message):
6565

6666

6767
def __time_limit_exceeded(message):
68+
from seleniumbase.common.exceptions import TimeLimitExceededException
69+
6870
raise TimeLimitExceededException(message)
6971

7072

seleniumbase/plugins/pytest_plugin.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
import time
99
from seleniumbase import config as sb_config
1010
from seleniumbase.config import settings
11-
from seleniumbase.core import download_helper
12-
from seleniumbase.core import log_helper
13-
from seleniumbase.core import proxy_helper
1411
from seleniumbase.fixtures import constants
1512

1613
pytest_plugins = ["pytester"] # Adds the "testdir" fixture
@@ -1166,8 +1163,11 @@ def pytest_configure(config):
11661163
else:
11671164
pass # Use the browser specified using "--browser=BROWSER"
11681165

1169-
if sb_config.with_testing_base:
1170-
log_helper.log_folder_setup(sb_config.log_path, sb_config.archive_logs)
1166+
from seleniumbase.core import log_helper
1167+
from seleniumbase.core import download_helper
1168+
from seleniumbase.core import proxy_helper
1169+
1170+
log_helper.log_folder_setup(sb_config.log_path, sb_config.archive_logs)
11711171
download_helper.reset_downloads_folder()
11721172
proxy_helper.remove_proxy_zip_if_present()
11731173

@@ -1346,6 +1346,9 @@ def pytest_terminal_summary(terminalreporter):
13461346

13471347

13481348
def _perform_pytest_unconfigure_():
1349+
from seleniumbase.core import log_helper
1350+
from seleniumbase.core import proxy_helper
1351+
13491352
proxy_helper.remove_proxy_zip_if_present()
13501353
if hasattr(sb_config, "reuse_session") and sb_config.reuse_session:
13511354
# Close the shared browser session

0 commit comments

Comments
 (0)