Skip to content

Commit c8d0860

Browse files
authored
Merge pull request #489 from radish-bdd/chore/ruff-enable-more-rules
Ruff enable more rules & Support Python 3.14
2 parents df5e5cb + e4ca151 commit c8d0860

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+327
-293
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
id-token: write
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v5
1818
- name: Set up Python
19-
uses: actions/setup-python@v5
19+
uses: actions/setup-python@v6
2020
with:
2121
python-version: '3.x'
2222
- name: Install dependencies

.github/workflows/main.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v4
10-
- name: Set up Python 3.13
11-
uses: actions/setup-python@v5
9+
- uses: actions/checkout@v5
10+
- name: Set up Python 3.14
11+
uses: actions/setup-python@v6
1212
with:
13-
python-version: 3.13
13+
python-version: 3.14
1414
- name: Setup and install tools
1515
run: python -m pip install ruff
1616
- name: ruff format check
@@ -23,17 +23,17 @@ jobs:
2323
fail-fast: false
2424
max-parallel: 8
2525
matrix:
26-
python-version: [3.7, 3.13]
26+
python-version: [3.7, 3.14]
2727
os: [ubuntu-22.04, windows-latest, macos-latest]
2828
exclude:
2929
- os: macos-latest
3030
python-version: 3.7
3131

3232
runs-on: ${{ matrix.os }}
3333
steps:
34-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@v5
3535
- name: Set up Python ${{ matrix.python-version }}
36-
uses: actions/setup-python@v5
36+
uses: actions/setup-python@v6
3737
with:
3838
python-version: ${{ matrix.python-version }}
3939
- name: Setup build and test environment
@@ -62,7 +62,7 @@ jobs:
6262
- name: Upload coverage to Codecov
6363
# codecov only runs on Linux
6464
if: startsWith(matrix.os, 'ubuntu-')
65-
uses: codecov/codecov-action@v4
65+
uses: codecov/codecov-action@v5
6666
with:
6767
token: ${{ secrets.CODECOV_TOKEN }}
6868
file: ./coverage.xml

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
66

77
*Stay tuned...*
88

9+
### Changes
10+
- Test Python 3.14 support
11+
- Update lxml to support Python 3.14
12+
913
## [v0.18.2]
1014

1115
### Fixed

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
line-length = 120
33
# Rule descriptions: https://docs.astral.sh/ruff/rules/
44
# TODO enable more linter
5-
#lint.select = ["E", "B", "N", "C4", "C90", "ARG", "PL", "RUF", "UP"]
6-
lint.select = ["F", "W", "I"]
5+
#lint.select = ["B", "N", "C90", "ARG", "PL", "RUF", "UP"]
6+
lint.select = ["E", "F", "W", "I", "C4"]
77

88
[tool.ruff.lint.per-file-ignores]
9-
# Example ignore for all tests (Magic value used in comparison)
109
# We use magic values in tests
1110
"tests/*" = ["PLR2004"]
12-
# There is a loot to look at with this rule,
11+
# There is a lot to look at with this rule,
1312
# not enforced yet
1413
"*" = ["F401"]

radish/background.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Background(Scenario):
1212
"""
1313

1414
def __init__(self, keyword, sentence, path, line, parent):
15-
super(Background, self).__init__(None, keyword, sentence, path, line, parent)
15+
super().__init__(None, keyword, sentence, path, line, parent)
1616

1717
def create_instance(self, parent=None, steps_runable=False):
1818
"""

radish/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .parser import FeatureParser
99

1010

11-
class Configuration(object):
11+
class Configuration:
1212
"""
1313
Manage configuration. Attributes of the class are created from the
1414
names of the command line options and are set to the command line
@@ -33,7 +33,7 @@ def __init__(self, arguments):
3333

3434

3535
# FIXME: rename
36-
class Core(object):
36+
class Core:
3737
"""
3838
Provide some core functionalities like parsing and storing of the feature files
3939
"""
@@ -51,7 +51,7 @@ def features_to_run(self):
5151
"""
5252
Return all parsed features which are to run
5353
"""
54-
return [f for f in self._features_to_run.values()]
54+
return list(self._features_to_run.values())
5555

5656
@property
5757
def next_feature_id(self):

radish/customtyperegistry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
@singleton()
13-
class CustomTypeRegistry(object):
13+
class CustomTypeRegistry:
1414
"""
1515
Registry for all custom argument expressions
1616
"""
@@ -23,7 +23,7 @@ def register(self, name, func):
2323
Registers a custom type
2424
"""
2525
if name in self.custom_types:
26-
raise RadishError("Cannot register custom type with name {0} because it already exists".format(name))
26+
raise RadishError("Cannot register custom type with name {} because it already exists".format(name))
2727

2828
self.custom_types[name] = func
2929

@@ -91,4 +91,4 @@ def boolean_type(text):
9191
Plus 0 and 1
9292
"""
9393
text = text.lower()
94-
return text == "1" or text.startswith("y") or text == "true" or text == "on"
94+
return text in {"1", "true", "on"} or text.startswith("y")

radish/errororacle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def write_error(text):
2020
"""
2121
Writes the given text to the console
2222
"""
23-
console_write("{0}: {1}".format(colorful.bold_red("Error"), colorful.red(text)))
23+
console_write("{}: {}".format(colorful.bold_red("Error"), colorful.red(text)))
2424

2525

2626
def write_failure(failure):
2727
"""
2828
Writes the failure to the console
2929
"""
30-
console_write("\n{0}".format(colorful.red(failure.traceback)))
30+
console_write("\n{}".format(colorful.red(failure.traceback)))
3131

3232

3333
def abort(return_code):

radish/examplescenario.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ class ExampleScenario(Scenario):
1111
"""
1212

1313
def __init__(self, id, keyword, sentence, path, line, parent, example, background=None):
14-
super(ExampleScenario, self).__init__(
15-
id, keyword, sentence, path, line, parent, parent.tags, background=background
16-
)
14+
super().__init__(id, keyword, sentence, path, line, parent, parent.tags, background=background)
1715
self.example = example
1816

1917
def has_to_run(self, scenario_choice):

radish/exceptions.py

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LanguageNotSupportedError(RadishError):
1818

1919
def __init__(self, language):
2020
self.language = language
21-
super(LanguageNotSupportedError, self).__init__("Language {0} could not be found".format(language))
21+
super().__init__("Language {} could not be found".format(language))
2222

2323

2424
class FeatureFileNotFoundError(RadishError):
@@ -28,7 +28,7 @@ class FeatureFileNotFoundError(RadishError):
2828

2929
def __init__(self, featurefile):
3030
self.featurefile = featurefile
31-
super(FeatureFileNotFoundError, self).__init__("Feature file '{0}': No such file".format(featurefile))
31+
super().__init__("Feature file '{}': No such file".format(featurefile))
3232

3333

3434
class FeatureFileSyntaxError(RadishError, SyntaxError):
@@ -45,9 +45,7 @@ class FeatureFileSyntaxError(RadishError, SyntaxError):
4545
Link: {docs_link}"""
4646

4747
def __init__(self, msg):
48-
super(FeatureFileSyntaxError, self).__init__(
49-
FeatureFileSyntaxError.MESSAGE_TEMPLATE.format(msg=msg, docs_link=__DOCS__)
50-
)
48+
super().__init__(FeatureFileSyntaxError.MESSAGE_TEMPLATE.format(msg=msg, docs_link=__DOCS__))
5149

5250

5351
class StepRegexError(RadishError, SyntaxError):
@@ -59,9 +57,7 @@ def __init__(self, regex, step_func_name, re_error):
5957
self.regex = regex
6058
self.step_func_name = step_func_name
6159
self.re_error = re_error
62-
super(StepRegexError, self).__init__(
63-
"Cannot compile regex '{0}' from step '{1}': {2}".format(regex, step_func_name, re_error)
64-
)
60+
super().__init__("Cannot compile regex '{}' from step '{}': {}".format(regex, step_func_name, re_error))
6561

6662

6763
class StepPatternError(RadishError, SyntaxError):
@@ -73,9 +69,7 @@ def __init__(self, pattern, step_func_name, error):
7369
self.pattern = pattern
7470
self.step_func_name = step_func_name
7571
self.error = error
76-
super(StepPatternError, self).__init__(
77-
"Cannot compile pattern '{0}' of step '{1}': {2}".format(pattern, step_func_name, error)
78-
)
72+
super().__init__("Cannot compile pattern '{}' of step '{}': {}".format(pattern, step_func_name, error))
7973

8074

8175
class SameStepError(RadishError):
@@ -95,9 +89,7 @@ def __init__(self, regex, func1, func2):
9589
self.regex = regex
9690
self.func1 = func1
9791
self.func2 = func2
98-
super(SameStepError, self).__init__(
99-
SameStepError.MESSAGE_TEMPLATE.format(func2.__name__, regex, func1.__name__)
100-
)
92+
super().__init__(SameStepError.MESSAGE_TEMPLATE.format(func2.__name__, regex, func1.__name__))
10193

10294

10395
class StepDefinitionNotFoundError(RadishError):
@@ -118,7 +110,7 @@ def my_step(step):
118110

119111
def __init__(self, step):
120112
self.step = step
121-
super(StepDefinitionNotFoundError, self).__init__(
113+
super().__init__(
122114
StepDefinitionNotFoundError.MESSAGE_TEMPLATE.format(
123115
sentence=step.sentence,
124116
step_path=step.path,
@@ -144,8 +136,8 @@ class HookError(RadishError):
144136
def __init__(self, hook_function, failure):
145137
self.hook_function = hook_function
146138
self.failure = failure
147-
super(HookError, self).__init__(
148-
"Hook '{0}' from {1}:{2} raised: '{3}: {4}'".format(
139+
super().__init__(
140+
"Hook '{}' from {}:{} raised: '{}: {}'".format(
149141
hook_function.__name__,
150142
hook_function.__code__.co_filename,
151143
hook_function.__code__.co_firstlineno,
@@ -163,8 +155,8 @@ class ScenarioNotFoundError(RadishError):
163155
def __init__(self, scenario_id, amount_of_scenarios):
164156
self.scenario_id = scenario_id
165157
self.amount_of_scenarios = amount_of_scenarios
166-
super(ScenarioNotFoundError, self).__init__(
167-
"No scenario with id {0} found. Specify a scenario id between 1 and {1}".format(
158+
super().__init__(
159+
"No scenario with id {} found. Specify a scenario id between 1 and {}".format(
168160
scenario_id, amount_of_scenarios
169161
)
170162
)

0 commit comments

Comments
 (0)