setup-selenium-testing 0.1.3__tar.gz → 0.1.6__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: setup-selenium-testing
3
- Version: 0.1.3
3
+ Version: 0.1.6
4
4
  Summary: Setup Selenium for automation testing
5
5
  Home-page: https://github.com/bandophahita/setup_selenium
6
6
  License: MIT
@@ -21,10 +21,9 @@ Classifier: Programming Language :: Python :: 3 :: Only
21
21
  Provides-Extra: dev
22
22
  Provides-Extra: test
23
23
  Requires-Dist: black ; extra == "dev"
24
- Requires-Dist: isort ; extra == "dev"
25
24
  Requires-Dist: mypy ; extra == "dev"
26
25
  Requires-Dist: pytest ; extra == "dev" or extra == "test"
27
- Requires-Dist: ruff ; extra == "dev"
26
+ Requires-Dist: ruff (>=0.2.0) ; extra == "dev"
28
27
  Requires-Dist: selenium (>=4.7.0)
29
28
  Requires-Dist: semantic-version
30
29
  Requires-Dist: tox ; extra == "dev" or extra == "test"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "setup-selenium-testing"
3
- version = "0.1.3"
3
+ version = "0.1.6"
4
4
  description = "Setup Selenium for automation testing"
5
5
  authors = ["Marcel Wilson <trenchrats@gmail.com>"]
6
6
  license = "MIT"
@@ -31,9 +31,8 @@ typing-extensions = "*"
31
31
  pytest = {version="*", optional = true}
32
32
  black = {version="*", optional = true}
33
33
  mypy = {version="*", optional = true}
34
- ruff = {version="*", optional = true}
34
+ ruff = {version = ">=0.2.0", optional = true}
35
35
  tox = {version="*", optional = true}
36
- isort = {version = "*", optional = true}
37
36
 
38
37
  [tool.poetry.extras]
39
38
  dev = [
@@ -41,7 +40,6 @@ dev = [
41
40
  "black",
42
41
  "mypy",
43
42
  "ruff",
44
- "isort",
45
43
  "tox",
46
44
  ]
47
45
  test = [
@@ -50,15 +48,6 @@ test = [
50
48
  ]
51
49
 
52
50
 
53
- [tool.isort]
54
- line_length = 88
55
- multi_line_output = 3
56
- include_trailing_comma = "True"
57
- use_parentheses = "True"
58
- combine_as_imports = "True"
59
- skip = [".idea", ".tox"]
60
-
61
-
62
51
  [build-system]
63
52
  requires = ["poetry-core>=1.2.0"]
64
53
  build-backend = "poetry.core.masonry.api"
@@ -77,9 +66,36 @@ build-backend = "poetry.core.masonry.api"
77
66
 
78
67
 
79
68
  [tool.ruff]
80
- # Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
81
- # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
82
- # McCabe complexity (`C901`) by default.
69
+ target-version = "py38"
70
+ line-length = 88
71
+ extend-exclude = [
72
+ ".github",
73
+ ".pytest_cache",
74
+ ".venv",
75
+ "venv",
76
+ "dockerfiles",
77
+ "docs",
78
+ ".coverage",
79
+ ".coveragerc",
80
+ ".env",
81
+ ".env.example",
82
+ ".flake8",
83
+ ".gitignore",
84
+ "alembic.ini",
85
+ "bandit.yaml",
86
+ "docker-compose-dev.yaml",
87
+ "docker-compose-pro.yaml",
88
+ "Makefile",
89
+ "mkdocks.yml",
90
+ "mypy.ini",
91
+ "poetry.lock",
92
+ "pyproject.toml",
93
+ "pytest.ini",
94
+ "README.md",
95
+ ".idea",
96
+ ]
97
+
98
+ [tool.ruff.lint]
83
99
  select = [
84
100
  "A", # flake8-builtins
85
101
  "ANN", # flake8-annotations # coming back to this one later to compare against mypy
@@ -163,43 +179,9 @@ ignore = [
163
179
  "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
164
180
  ]
165
181
 
166
- # Same as Black.
167
- line-length = 88
168
- target-version = "py310"
169
-
170
- exclude = [
171
- ".github",
172
- ".pytest_cache",
173
- ".venv",
174
- "venv",
175
- "dockerfiles",
176
- "docs",
177
- ".coverage",
178
- ".coveragerc",
179
- ".env",
180
- ".env.example",
181
- ".flake8",
182
- ".gitignore",
183
- "alembic.ini",
184
- "bandit.yaml",
185
- "docker-compose-dev.yaml",
186
- "docker-compose-pro.yaml",
187
- "Makefile",
188
- "mkdocks.yml",
189
- "mypy.ini",
190
- "poetry.lock",
191
- "pyproject.toml",
192
- "pytest.ini",
193
- "README.md",
194
- ".idea",
195
- ]
196
-
197
- [tool.ruff.lint]
198
182
  extend-safe-fixes = [
199
- "EM101",
200
- "EM102",
183
+ "EM101", "EM102",
201
184
  "TCH001", "TCH002", "TCH003", "TCH004",
202
- # "SIM108"
203
185
  "C419",
204
186
  "D200", "D205",
205
187
  "PT003", "PT006", "PT018",
@@ -207,28 +189,24 @@ extend-safe-fixes = [
207
189
  "UP007",
208
190
  ]
209
191
 
210
- [tool.ruff.per-file-ignores]
192
+ [tool.ruff.lint.flake8-pytest-style]
193
+ mark-parentheses = false
194
+
195
+ [tool.ruff.lint.pycodestyle]
196
+ ignore-overlong-task-comments = true
197
+
198
+ [tool.ruff.lint.isort]
199
+ combine-as-imports = true
200
+ split-on-trailing-comma = false
201
+
202
+ [tool.ruff.lint.per-file-ignores]
211
203
  "__init__.py" = ["F401"]
212
204
  "tests/**" = [
213
205
  "D", # we don't need public-API-polished docstrings in tests.
214
206
  "FBT", # using a boolean as a test object is useful!
215
207
  "PLR", # likewise using specific numbers and strings in tests.
216
208
  ]
217
-
218
- [tool.ruff.isort]
219
- combine-as-imports = true
220
- split-on-trailing-comma = true
221
-
222
-
223
- [tool.ruff.flake8-pytest-style]
224
- mark-parentheses = false
225
-
226
-
227
- [tool.ruff.pycodestyle]
228
- ignore-overlong-task-comments = true
229
-
230
-
231
- [tool.ruff.flake8-annotations]
209
+ [tool.ruff.lint.flake8-annotations]
232
210
  # ignore returns types for functions that implicity or explicitly only return None
233
211
  suppress-none-returning = true
234
212
  allow-star-arg-any = true
@@ -0,0 +1 @@
1
+ from .setup_selenium import Browser, SetupSelenium, set_logger
@@ -8,7 +8,7 @@ import os as os
8
8
  from enum import Enum
9
9
  from typing import TYPE_CHECKING, Optional, Union
10
10
 
11
- from selenium import webdriver
11
+ from selenium import __version__, webdriver
12
12
  from selenium.common.exceptions import NoSuchWindowException, WebDriverException
13
13
  from selenium.webdriver.chrome.service import Service as ChromeService
14
14
  from selenium.webdriver.common.selenium_manager import SeleniumManager
@@ -28,6 +28,11 @@ if TYPE_CHECKING:
28
28
  webdriver.FirefoxOptions, webdriver.ChromeOptions, webdriver.EdgeOptions
29
29
  ]
30
30
 
31
+ NEW_SELENIUM = False
32
+ if Version(__version__) >= Version("4.20.0"):
33
+ NEW_SELENIUM = True
34
+
35
+
31
36
  __all__ = ["SetupSelenium"]
32
37
 
33
38
 
@@ -171,7 +176,11 @@ class SetupSelenium:
171
176
  driver_version = driver_version or None
172
177
 
173
178
  sm = SeleniumManager()
174
- args = [f"{sm.get_binary()}", "--browser", browser]
179
+
180
+ if NEW_SELENIUM:
181
+ args = [f"{sm._get_binary()}", "--browser", browser]
182
+ else:
183
+ args = [f"{sm.get_binary()}", "--browser", browser] # type: ignore[attr-defined]
175
184
 
176
185
  if browser_version:
177
186
  args.append("--browser-version")
@@ -187,7 +196,12 @@ class SetupSelenium:
187
196
  args.append("--browser-path")
188
197
  args.append(browser_path)
189
198
 
190
- output = sm.run(args)
199
+ if NEW_SELENIUM:
200
+ args.append("--output")
201
+ args.append("json")
202
+ output = sm._run(args)
203
+ else:
204
+ output = sm.run(args) # type: ignore[attr-defined]
191
205
  driver_path = output["driver_path"]
192
206
  browser_path = output["browser_path"]
193
207
 
@@ -288,10 +302,14 @@ class SetupSelenium:
288
302
  # log file. if we enable root logging, we can capture the logging from
289
303
  # geckodriver, ourselves.
290
304
  logpath = os.path.devnull
291
- options.log.level = "fatal" # type: ignore[assignment]
292
305
  if enable_log_driver:
293
306
  lp = os.path.abspath(os.path.expanduser(log_dir))
294
307
  logpath = os.path.join(lp, "geckodriver.log")
308
+ if not options.log.level:
309
+ options.log.level = "trace" # type: ignore[assignment]
310
+
311
+ if not options.log.level:
312
+ options.log.level = "fatal" # type: ignore[assignment]
295
313
 
296
314
  if driver_path:
297
315
  service = FirefoxService(
@@ -1 +0,0 @@
1
- from .selenium_module import Browser, SetupSelenium, set_logger