Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
- uses: actions/checkout@v5
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: 3.13
python-version: 3.14
- name: Setup and install tools
run: python -m pip install ruff
- name: ruff format check
Expand All @@ -23,17 +23,17 @@ jobs:
fail-fast: false
max-parallel: 8
matrix:
python-version: [3.7, 3.13]
python-version: [3.7, 3.14]
os: [ubuntu-22.04, windows-latest, macos-latest]
exclude:
- os: macos-latest
python-version: 3.7

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Setup build and test environment
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Upload coverage to Codecov
# codecov only runs on Linux
if: startsWith(matrix.os, 'ubuntu-')
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).

*Stay tuned...*

### Changes
- Test Python 3.14 support
- Update lxml to support Python 3.14

## [v0.18.2]

### Fixed
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
line-length = 120
# Rule descriptions: https://docs.astral.sh/ruff/rules/
# TODO enable more linter
#lint.select = ["E", "B", "N", "C4", "C90", "ARG", "PL", "RUF", "UP"]
lint.select = ["F", "W", "I"]
#lint.select = ["B", "N", "C90", "ARG", "PL", "RUF", "UP"]
lint.select = ["E", "F", "W", "I", "C4"]

[tool.ruff.lint.per-file-ignores]
# Example ignore for all tests (Magic value used in comparison)
# We use magic values in tests
"tests/*" = ["PLR2004"]
# There is a loot to look at with this rule,
# There is a lot to look at with this rule,
# not enforced yet
"*" = ["F401"]
2 changes: 1 addition & 1 deletion radish/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Background(Scenario):
"""

def __init__(self, keyword, sentence, path, line, parent):
super(Background, self).__init__(None, keyword, sentence, path, line, parent)
super().__init__(None, keyword, sentence, path, line, parent)

def create_instance(self, parent=None, steps_runable=False):
"""
Expand Down
6 changes: 3 additions & 3 deletions radish/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .parser import FeatureParser


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


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

@property
def next_feature_id(self):
Expand Down
6 changes: 3 additions & 3 deletions radish/customtyperegistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@singleton()
class CustomTypeRegistry(object):
class CustomTypeRegistry:
"""
Registry for all custom argument expressions
"""
Expand All @@ -23,7 +23,7 @@ def register(self, name, func):
Registers a custom type
"""
if name in self.custom_types:
raise RadishError("Cannot register custom type with name {0} because it already exists".format(name))
raise RadishError("Cannot register custom type with name {} because it already exists".format(name))

self.custom_types[name] = func

Expand Down Expand Up @@ -91,4 +91,4 @@ def boolean_type(text):
Plus 0 and 1
"""
text = text.lower()
return text == "1" or text.startswith("y") or text == "true" or text == "on"
return text in {"1", "true", "on"} or text.startswith("y")
4 changes: 2 additions & 2 deletions radish/errororacle.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ def write_error(text):
"""
Writes the given text to the console
"""
console_write("{0}: {1}".format(colorful.bold_red("Error"), colorful.red(text)))
console_write("{}: {}".format(colorful.bold_red("Error"), colorful.red(text)))


def write_failure(failure):
"""
Writes the failure to the console
"""
console_write("\n{0}".format(colorful.red(failure.traceback)))
console_write("\n{}".format(colorful.red(failure.traceback)))


def abort(return_code):
Expand Down
4 changes: 1 addition & 3 deletions radish/examplescenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ class ExampleScenario(Scenario):
"""

def __init__(self, id, keyword, sentence, path, line, parent, example, background=None):
super(ExampleScenario, self).__init__(
id, keyword, sentence, path, line, parent, parent.tags, background=background
)
super().__init__(id, keyword, sentence, path, line, parent, parent.tags, background=background)
self.example = example

def has_to_run(self, scenario_choice):
Expand Down
30 changes: 11 additions & 19 deletions radish/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LanguageNotSupportedError(RadishError):

def __init__(self, language):
self.language = language
super(LanguageNotSupportedError, self).__init__("Language {0} could not be found".format(language))
super().__init__("Language {} could not be found".format(language))


class FeatureFileNotFoundError(RadishError):
Expand All @@ -28,7 +28,7 @@ class FeatureFileNotFoundError(RadishError):

def __init__(self, featurefile):
self.featurefile = featurefile
super(FeatureFileNotFoundError, self).__init__("Feature file '{0}': No such file".format(featurefile))
super().__init__("Feature file '{}': No such file".format(featurefile))


class FeatureFileSyntaxError(RadishError, SyntaxError):
Expand All @@ -45,9 +45,7 @@ class FeatureFileSyntaxError(RadishError, SyntaxError):
Link: {docs_link}"""

def __init__(self, msg):
super(FeatureFileSyntaxError, self).__init__(
FeatureFileSyntaxError.MESSAGE_TEMPLATE.format(msg=msg, docs_link=__DOCS__)
)
super().__init__(FeatureFileSyntaxError.MESSAGE_TEMPLATE.format(msg=msg, docs_link=__DOCS__))


class StepRegexError(RadishError, SyntaxError):
Expand All @@ -59,9 +57,7 @@ def __init__(self, regex, step_func_name, re_error):
self.regex = regex
self.step_func_name = step_func_name
self.re_error = re_error
super(StepRegexError, self).__init__(
"Cannot compile regex '{0}' from step '{1}': {2}".format(regex, step_func_name, re_error)
)
super().__init__("Cannot compile regex '{}' from step '{}': {}".format(regex, step_func_name, re_error))


class StepPatternError(RadishError, SyntaxError):
Expand All @@ -73,9 +69,7 @@ def __init__(self, pattern, step_func_name, error):
self.pattern = pattern
self.step_func_name = step_func_name
self.error = error
super(StepPatternError, self).__init__(
"Cannot compile pattern '{0}' of step '{1}': {2}".format(pattern, step_func_name, error)
)
super().__init__("Cannot compile pattern '{}' of step '{}': {}".format(pattern, step_func_name, error))


class SameStepError(RadishError):
Expand All @@ -95,9 +89,7 @@ def __init__(self, regex, func1, func2):
self.regex = regex
self.func1 = func1
self.func2 = func2
super(SameStepError, self).__init__(
SameStepError.MESSAGE_TEMPLATE.format(func2.__name__, regex, func1.__name__)
)
super().__init__(SameStepError.MESSAGE_TEMPLATE.format(func2.__name__, regex, func1.__name__))


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

def __init__(self, step):
self.step = step
super(StepDefinitionNotFoundError, self).__init__(
super().__init__(
StepDefinitionNotFoundError.MESSAGE_TEMPLATE.format(
sentence=step.sentence,
step_path=step.path,
Expand All @@ -144,8 +136,8 @@ class HookError(RadishError):
def __init__(self, hook_function, failure):
self.hook_function = hook_function
self.failure = failure
super(HookError, self).__init__(
"Hook '{0}' from {1}:{2} raised: '{3}: {4}'".format(
super().__init__(
"Hook '{}' from {}:{} raised: '{}: {}'".format(
hook_function.__name__,
hook_function.__code__.co_filename,
hook_function.__code__.co_firstlineno,
Expand All @@ -163,8 +155,8 @@ class ScenarioNotFoundError(RadishError):
def __init__(self, scenario_id, amount_of_scenarios):
self.scenario_id = scenario_id
self.amount_of_scenarios = amount_of_scenarios
super(ScenarioNotFoundError, self).__init__(
"No scenario with id {0} found. Specify a scenario id between 1 and {1}".format(
super().__init__(
"No scenario with id {} found. Specify a scenario id between 1 and {}".format(
scenario_id, amount_of_scenarios
)
)
Expand Down
6 changes: 3 additions & 3 deletions radish/extensionregistry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


@singleton()
class ExtensionRegistry(object):
class ExtensionRegistry:
"""
Registers all extensions
"""
Expand Down Expand Up @@ -54,7 +54,7 @@ def get_options(self):
options.extend(opt[0] for opt in ext.OPTIONS)
except AttributeError:
pass
return "\n ".join("[{0}]".format(x) for x in options)
return "\n ".join("[{}]".format(x) for x in options)

def get_option_description(self):
"""
Expand All @@ -63,7 +63,7 @@ def get_option_description(self):
options = []
for ext in self.extensions:
try:
options.extend("{0} {1}".format(opt[0].ljust(43), opt[1]) for opt in ext.OPTIONS)
options.extend("{} {}".format(opt[0].ljust(43), opt[1]) for opt in ext.OPTIONS)
except AttributeError:
pass
return "\n ".join(options)
Expand Down
11 changes: 6 additions & 5 deletions radish/extensions/bdd_xml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from os import getlogin
from socket import gethostname

import radish.utils as utils
from radish import utils
from radish.exceptions import RadishError
from radish.extensionregistry import extension
from radish.hookregistry import after
Expand All @@ -19,7 +19,7 @@


@extension
class BDDXMLWriter(object):
class BDDXMLWriter:
"""
BDD XML Writer radish extension
"""
Expand All @@ -33,7 +33,8 @@ def __init__(self):
from lxml import etree
except ImportError:
raise RadishError(
'if you want to use the BDD xml writer you have to install extra packages: "pip install radish-bdd[bddxml]"'
"if you want to use the BDD xml writer you have to install extra packages: "
'"pip install radish-bdd[bddxml]"'
)

after.all(self.generate_bdd_xml)
Expand Down Expand Up @@ -95,7 +96,7 @@ def generate_bdd_xml(self, features, marker):
starttime=utils.format_utc_to_local_tz(features[0].starttime),
endtime=utils.format_utc_to_local_tz(features[-1].endtime),
duration=str(duration.total_seconds()),
agent="{0}@{1}".format(user, gethostname()),
agent="{}@{}".format(user, gethostname()),
)

for feature in features:
Expand Down Expand Up @@ -128,7 +129,7 @@ def generate_bdd_xml(self, features, marker):
tag_element = etree.Element("tag")
tag_element.text = tag.name
if tag.arg:
tag_element.text += "({0})".format(tag.arg)
tag_element.text += "({})".format(tag.arg)
scenario_tags_element.append(tag_element)

for step in scenario.all_steps:
Expand Down
4 changes: 2 additions & 2 deletions radish/extensions/codecoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


@extension
class CodeCoverage(object):
class CodeCoverage:
"""
Code Coverage radish extension
"""
Expand Down Expand Up @@ -118,7 +118,7 @@ def coverage_stop(self, features, marker):
total_percentage = int(match.groups()[0].split()[-1][:-1])
if total_percentage < int(world.config.cover_min_percentage):
raise RadishError(
"Failed to reach minimum expected coverage of {0}% (reached: {1}%)".format(
"Failed to reach minimum expected coverage of {}% (reached: {}%)".format(
world.config.cover_min_percentage, total_percentage
)
)
2 changes: 1 addition & 1 deletion radish/extensions/cucumber_json_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@extension
class CucumberJSONWriter(object):
class CucumberJSONWriter:
"""
cucumber json Writer radish extension
"""
Expand Down
Loading
Loading