Skip to content
Snippets Groups Projects
Commit a29574c5 authored by Brandon Rodriguez's avatar Brandon Rodriguez
Browse files

Correct project handling when selenium package is not installed

parent 607d4377
Branches
Tags
No related merge requests found
......@@ -12,4 +12,30 @@ from .response_mixin import ResponseTestCaseMixin
# Expanded "LiveServer" TestCase utility mixins.
from .live_server_mixin import LiveServerMixin
try:
from .live_server_mixin import LiveServerMixin
except ModuleNotFoundError:
# Project likely does not have selenium package installed.
# This is okay, as we don't want this logic as a hard requirement to use this library.
# However, we do want to define a dummy class to give feedback errors.
class LiveServerTestCase():
err_msg = """
Cannot use LiveServer TestCases class without "selenium" package installed.
To use these TestCases, add the following packages to your project:
* selenium # Required
* channels # Optional, used in ChannelsLiveServerTestCase only.
* daphne # Optional, used in ChannelsLiveServerTestCase only.
For more information, see:
https://www.selenium.dev/documentation/webdriver/getting_started/
"""
@classmethod
def setUpClass(cls):
raise Exception(cls.err_msg)
def setUp(self):
raise Exception(self.err_msg)
def __int__(self):
raise Exception(self.err_msg)
......@@ -24,7 +24,6 @@ except ModuleNotFoundError:
Cannot use LiveServerTestCase class without "selenium" package installed.
To use this TestCase, add the following packages to your project:
* selenium # Required
* webdriver-manager # Required
For more information, see:
https://www.selenium.dev/documentation/webdriver/getting_started/
......@@ -54,7 +53,7 @@ except ModuleNotFoundError:
To use this TestCase, add the following packages to your project:
* channels # Required
* daphne # Required
* webdriver-manager # Required
* selenium # Required
For more information, see:
https://www.selenium.dev/documentation/webdriver/getting_started/
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment