Skip to content

Commit c52437b

Browse files
committed
Initial Python 3.12 support
1 parent f74ea79 commit c52437b

6 files changed

+52
-6
lines changed

.github/workflows/CI.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
continue-on-error: true
1010
strategy:
1111
matrix:
12-
python-version: [3.8, 3.11] # 3.12, pypy-3.9
12+
python-version: [3.8, 3.12] # 3.12, pypy-3.9
1313
rf-version: [5.0.1, 6.1.1, 7.0]
1414
selenium-version: [4.20.0, 4.21.0]
1515
browser: [firefox, chrome, headlesschrome] #edge

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SeleniumLibrary_ is a web testing library for `Robot Framework`_ that
1010
utilizes the Selenium_ tool internally. The project is hosted on GitHub_
1111
and downloads can be found from PyPI_.
1212

13-
SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.11.
13+
SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.12.
1414
In addition to the normal Python_ interpreter, it works also
1515
with PyPy_.
1616

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Selenium options string errors
2+
3+
0) method("arg1) ('unterminated string literal (detected at line 1)', (1, 8))
4+
1) method(arg1") ('unterminated string literal (detected at line 1)', (1, 12))
5+
2) method(arg1) Unable to parse option: "method(arg1)"
6+
3) attribute=arg1 Unable to parse option: "attribute=arg1"
7+
4) attribute=webdriver Unable to parse option: "attribute=webdriver"
8+
5) method(argument="value") Unable to parse option: "method(argument="value")"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Selenium service string errors
2+
3+
0) attribute=arg1 Unable to parse service: "attribute=arg1"
4+
1) attribute='arg1 ('unterminated string literal (detected at line 1)', (1, 11))
5+
2) attribute=['arg1' ('unexpected EOF in multi-line statement', (1, 0))
6+
3) attribute=['arg1';'arg2'] ('unexpected EOF in multi-line statement', (1, 0))
7+
4) attribute['arg1'] Unable to parse service: "attribute['arg1']"
8+
5) attribute=['arg1'] attribute=['arg2'] Unable to parse service: "attribute=['arg1'] attribute=['arg2']"

utest/test/keywords/test_selenium_options_parser.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
import unittest
34

45
import pytest
@@ -102,7 +103,8 @@ def test_parse_arguemnts(options, reporter):
102103
verify_all("Parse arguments from complex object", results, reporter=reporter)
103104

104105

105-
@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds")
106+
@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds")
107+
@pytest.mark.skipif(sys.version_info > (3, 11), reason="Errors change with Python 3.12")
106108
def test_parse_options_string_errors(options, reporter):
107109
results = []
108110
results.append(error_formatter(options._parse, 'method("arg1)', True))
@@ -114,6 +116,19 @@ def test_parse_options_string_errors(options, reporter):
114116
verify_all("Selenium options string errors", results, reporter=reporter)
115117

116118

119+
@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds")
120+
@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12")
121+
def test_parse_options_string_errors_py3_12(options, reporter):
122+
results = []
123+
results.append(error_formatter(options._parse, 'method("arg1)', True))
124+
results.append(error_formatter(options._parse, 'method(arg1")', True))
125+
results.append(error_formatter(options._parse, "method(arg1)", True))
126+
results.append(error_formatter(options._parse, "attribute=arg1", True))
127+
results.append(error_formatter(options._parse, "attribute=webdriver", True))
128+
results.append(error_formatter(options._parse, 'method(argument="value")', True))
129+
verify_all("Selenium options string errors", results, reporter=reporter)
130+
131+
117132
@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds")
118133
def test_split_options(options, reporter):
119134
results = []
@@ -203,8 +218,6 @@ def output_dir():
203218
output_dir = os.path.abspath(os.path.join(curr_dir, "..", "..", "output_dir"))
204219
return output_dir
205220

206-
from selenium.webdriver.chrome.service import Service as ChromeService
207-
208221

209222
def test_create_chrome_with_options(creator):
210223
options = mock()

utest/test/keywords/test_selenium_service_parser.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import sys
23
import unittest
34

45
import pytest
@@ -53,7 +54,10 @@ def test_parse_service_string(service, reporter):
5354
verify_all("Selenium service string to dict", results, reporter=reporter)
5455

5556

56-
@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds")
57+
# @unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds")
58+
# @unittest.skipIf(sys.version_info > (3, 11), reason="Errors change with Python 3.12")
59+
@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds")
60+
@pytest.mark.skipif(sys.version_info > (3, 11), reason="Errors change with Python 3.12")
5761
def test_parse_service_string_errors(service, reporter):
5862
results = []
5963
results.append(error_formatter(service._parse, "attribute=arg1", True))
@@ -65,6 +69,19 @@ def test_parse_service_string_errors(service, reporter):
6569
verify_all("Selenium service string errors", results, reporter=reporter)
6670

6771

72+
@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds")
73+
@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12")
74+
def test_parse_service_string_errors_py3_12(service, reporter):
75+
results = []
76+
results.append(error_formatter(service._parse, "attribute=arg1", True))
77+
results.append(error_formatter(service._parse, "attribute='arg1", True))
78+
results.append(error_formatter(service._parse, "attribute=['arg1'", True))
79+
results.append(error_formatter(service._parse, "attribute=['arg1';'arg2']", True))
80+
results.append(error_formatter(service._parse, "attribute['arg1']", True))
81+
results.append(error_formatter(service._parse, "attribute=['arg1'] attribute=['arg2']", True))
82+
verify_all("Selenium service string errors", results, reporter=reporter)
83+
84+
6885
@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds")
6986
def test_split_service(service, reporter):
7087
results = []

0 commit comments

Comments
 (0)