Skip to content

Commit

Permalink
Initial Python 3.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
emanlove committed Sep 5, 2024
1 parent f74ea79 commit c52437b
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
continue-on-error: true
strategy:
matrix:
python-version: [3.8, 3.11] # 3.12, pypy-3.9
python-version: [3.8, 3.12] # 3.12, pypy-3.9
rf-version: [5.0.1, 6.1.1, 7.0]
selenium-version: [4.20.0, 4.21.0]
browser: [firefox, chrome, headlesschrome] #edge
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SeleniumLibrary_ is a web testing library for `Robot Framework`_ that
utilizes the Selenium_ tool internally. The project is hosted on GitHub_
and downloads can be found from PyPI_.

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Selenium options string errors

0) method("arg1) ('unterminated string literal (detected at line 1)', (1, 8))
1) method(arg1") ('unterminated string literal (detected at line 1)', (1, 12))
2) method(arg1) Unable to parse option: "method(arg1)"
3) attribute=arg1 Unable to parse option: "attribute=arg1"
4) attribute=webdriver Unable to parse option: "attribute=webdriver"
5) method(argument="value") Unable to parse option: "method(argument="value")"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Selenium service string errors

0) attribute=arg1 Unable to parse service: "attribute=arg1"
1) attribute='arg1 ('unterminated string literal (detected at line 1)', (1, 11))
2) attribute=['arg1' ('unexpected EOF in multi-line statement', (1, 0))
3) attribute=['arg1';'arg2'] ('unexpected EOF in multi-line statement', (1, 0))
4) attribute['arg1'] Unable to parse service: "attribute['arg1']"
5) attribute=['arg1'] attribute=['arg2'] Unable to parse service: "attribute=['arg1'] attribute=['arg2']"
19 changes: 16 additions & 3 deletions utest/test/keywords/test_selenium_options_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import unittest

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


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


@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds")
@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12")
def test_parse_options_string_errors_py3_12(options, reporter):
results = []
results.append(error_formatter(options._parse, 'method("arg1)', True))
results.append(error_formatter(options._parse, 'method(arg1")', True))
results.append(error_formatter(options._parse, "method(arg1)", True))
results.append(error_formatter(options._parse, "attribute=arg1", True))
results.append(error_formatter(options._parse, "attribute=webdriver", True))
results.append(error_formatter(options._parse, 'method(argument="value")', True))
verify_all("Selenium options string errors", results, reporter=reporter)


@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds")
def test_split_options(options, reporter):
results = []
Expand Down Expand Up @@ -203,8 +218,6 @@ def output_dir():
output_dir = os.path.abspath(os.path.join(curr_dir, "..", "..", "output_dir"))
return output_dir

from selenium.webdriver.chrome.service import Service as ChromeService


def test_create_chrome_with_options(creator):
options = mock()
Expand Down
19 changes: 18 additions & 1 deletion utest/test/keywords/test_selenium_service_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import unittest

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


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


@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds")
@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12")
def test_parse_service_string_errors_py3_12(service, reporter):
results = []
results.append(error_formatter(service._parse, "attribute=arg1", True))
results.append(error_formatter(service._parse, "attribute='arg1", True))
results.append(error_formatter(service._parse, "attribute=['arg1'", True))
results.append(error_formatter(service._parse, "attribute=['arg1';'arg2']", True))
results.append(error_formatter(service._parse, "attribute['arg1']", True))
results.append(error_formatter(service._parse, "attribute=['arg1'] attribute=['arg2']", True))
verify_all("Selenium service string errors", results, reporter=reporter)


@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds")
def test_split_service(service, reporter):
results = []
Expand Down

0 comments on commit c52437b

Please sign in to comment.