Skip to content

Commit

Permalink
Merge pull request #480 from radish-bdd/reduce-compat
Browse files Browse the repository at this point in the history
Reduce compat
  • Loading branch information
fliiiix authored Dec 19, 2024
2 parents f989517 + 13584f9 commit 564ebdc
Show file tree
Hide file tree
Showing 120 changed files with 77 additions and 339 deletions.
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# radish documentation build configuration file, created by
# sphinx-quickstart on Sat Jun 13 21:58:55 2015.
#
Expand Down
4 changes: 0 additions & 4 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ Let's write our first feature file called *radish/steps.py*:

.. code:: python
# -*- coding: utf-8 -*-
from radish import given, when, then
@given("I have the numbers {number1:g} and {number2:g}")
Expand Down Expand Up @@ -73,8 +71,6 @@ For our *calculator* tests we use the *radish/terrain.py* file to instantiate th

.. code:: python
# -*- coding: utf-8 -*-
from radish import before, after
from calculator import Calculator
Expand Down
2 changes: 0 additions & 2 deletions radish/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

__DESCRIPTION__ = "Behaviour-Driven-Development tool for Python"
__LICENSE__ = "MIT"
__VERSION__ = "0.17.1"
Expand Down
2 changes: 0 additions & 2 deletions radish/background.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a representation of a Feature Background.
"""
Expand Down
17 changes: 0 additions & 17 deletions radish/compat.py

This file was deleted.

2 changes: 0 additions & 2 deletions radish/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
Providing radish core functionality.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/customtyperegistry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides the Argument-Expression Registry
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/errororacle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides some functionality to diagnose thrown exceptions
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/examplescenario.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a class to represent one Scenario Outline Example
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

from .terrain import world


Expand Down
2 changes: 0 additions & 2 deletions radish/extensionregistry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
Provide plugin interface for radish extensions
"""
Expand Down
1 change: 0 additions & 1 deletion radish/extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
2 changes: 0 additions & 2 deletions radish/extensions/bdd_xml_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a hook which generates a BDD XML result file at the end of the run.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/codecoverage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a radish extension to make
coverage measurements.
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/cucumber_json_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a hook which generates a cucumber json result file at the end of the run.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/endreport_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This radish extension module provide the functionality to write the end report
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/failure_debugger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides an extension which starts a debugger when a step fails
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/failure_inspector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides an extension which starts a python shell after a step failed
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/formatters/dots.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This radish extension provides the functionality to write the feature file run to the console.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/formatters/gherkin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This radish extension provides the functionality to write the feature file run to the console.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/junit_xml_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a hook which generates a JUnit XML result file at the end of the run.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/syslog_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides an extension to write all features, scenarios and steps to the syslog.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/extensions/time_recorder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module is a REQUIRED extension to record the time of Features, Scenarios and Steps
"""
Expand Down
3 changes: 1 addition & 2 deletions radish/extensions/user_data.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-

"""
This module provides a hook which processes user specified data on the command-line
and provides this data as a dictionary attached to the world.config object
as per Enhancement #124.
"""

import re

from radish.terrain import world
Expand Down
2 changes: 0 additions & 2 deletions radish/feature.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a class to represent a Feature from a parsed feature file.
"""
Expand Down
8 changes: 3 additions & 5 deletions radish/hookregistry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

"""
This module provides a registry for all hooks
This module provides a registry for all hooks
"""

from singleton import singleton
Expand Down Expand Up @@ -127,8 +125,8 @@ def call(self, when, what, ascending, model, *args, **kwargs):
"""
for _, on_tags, func in sorted(self._hooks[what][when], key=lambda h: h[0], reverse=not ascending):
if not self.__has_to_run(model, on_tags):
# # this hook does not have to run because
# # it was excluded due to the tags for this model
# this hook does not have to run because
# it was excluded due to the tags for this model
continue

try:
Expand Down
2 changes: 0 additions & 2 deletions radish/iterationscenario.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a Scenario which represents one iteration in a ScenarioLoop
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/loader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module contains a class to load the step and terrain files
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import os
import sys
import uuid
Expand Down
5 changes: 1 addition & 4 deletions radish/matcher.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a class to match the feature file steps with the registered steps from the registry
"""
Expand All @@ -11,7 +9,6 @@

from .customtyperegistry import CustomTypeRegistry
from .exceptions import StepDefinitionNotFoundError, StepPatternError
from .compat import re_pattern

StepMatch = namedtuple("StepMatch", ["argument_match", "func"])

Expand Down Expand Up @@ -89,7 +86,7 @@ def match_step(sentence, steps):
"""
potentional_matches = []
for pattern, func in steps.items():
if isinstance(pattern, re_pattern): # pylint: disable=protected-access
if isinstance(pattern, re.Pattern): # pylint: disable=protected-access
match = pattern.search(sentence)
argument_match = RegexStepArguments(match)
if match:
Expand Down
2 changes: 0 additions & 2 deletions radish/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This model provides a base class for all models:
Expand Down
5 changes: 1 addition & 4 deletions radish/parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
Feature file parser.
One Feature file parser instance is able to parse one feature file.
Expand All @@ -13,7 +11,6 @@
import copy
import string

from .compat import RecursionError
from .exceptions import RadishError, FeatureFileSyntaxError, LanguageNotSupportedError
from .feature import Feature
from .scenario import Scenario
Expand Down Expand Up @@ -519,7 +516,7 @@ def _parse_precondition(self, arguments):
try:
current_tags = self._current_tags + self.feature.tags + self._inherited_tags
feature = self._core.parse_feature(feature_file, self._tag_expr, inherited_tags=current_tags)
except (RuntimeError, RecursionError) as e:
except RecursionError as e:
if str(e).startswith("maximum recursion depth exceeded"): # precondition cycling
raise FeatureFileSyntaxError(
"Your feature '{0}' has cycling preconditions with '{1}: {2}' starting at line {3}".format(
Expand Down
2 changes: 0 additions & 2 deletions radish/runner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
Providing radish core functionality like the feature file Runner.
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/scenario.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a class to represent a Scenario
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/scenarioloop.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a Scenario type which represents a Scenario loop
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/scenariooutline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a class to represent a Scenario Outline
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/stepmodel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a class to represent a Step
"""
Expand Down
9 changes: 3 additions & 6 deletions radish/stepregistry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a registry for all custom steps which were decorated with the @step-decorator.
"""
Expand All @@ -9,7 +7,6 @@
from singleton import singleton

from .exceptions import RadishError, SameStepError, StepRegexError
from .compat import re_pattern


@singleton()
Expand Down Expand Up @@ -141,7 +138,7 @@ def given(pattern):
"""
Step decorator prefixed with the Given-keyword.
"""
if isinstance(pattern, re_pattern): # pylint: disable=protected-access
if isinstance(pattern, re.Pattern): # pylint: disable=protected-access
return step(re.compile(r"Given {0}".format(pattern.pattern)))
return step("Given {0}".format(pattern))

Expand All @@ -150,7 +147,7 @@ def when(pattern):
"""
Step decorator prefixed with the When-keyword.
"""
if isinstance(pattern, re_pattern): # pylint: disable=protected-access
if isinstance(pattern, re.Pattern): # pylint: disable=protected-access
return step(re.compile(r"When {0}".format(pattern.pattern)))
return step("When {0}".format(pattern))

Expand All @@ -159,6 +156,6 @@ def then(pattern):
"""
Step decorator prefixed with the Then-keyword.
"""
if isinstance(pattern, re_pattern): # pylint: disable=protected-access
if isinstance(pattern, re.Pattern): # pylint: disable=protected-access
return step(re.compile(r"Then {0}".format(pattern.pattern)))
return step("Then {0}".format(pattern))
2 changes: 0 additions & 2 deletions radish/terrain.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
Terrain module providing step overlapping data containers
"""
Expand Down
2 changes: 0 additions & 2 deletions radish/testing/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides a script to test the
radish step implementations
Expand Down
2 changes: 0 additions & 2 deletions radish/testing/matches.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides functionaliy to test
if some sentences are matched with the expected
Expand Down
2 changes: 0 additions & 2 deletions radish/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

"""
This module provides several utility functions
"""
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring

import os
Expand Down
1 change: 0 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
10 changes: 4 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-

"""
radish
~~~~~~
radish
~~~~~~
Behavior Driven Development tool for Python - the root from red to green
Behavior Driven Development tool for Python - the root from red to green
Copyright: MIT, Timo Furrer <[email protected]>
Copyright: MIT, Timo Furrer <[email protected]>
"""

import os
Expand Down
2 changes: 0 additions & 2 deletions tests/data/radish/steps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import re
from radish.terrain import world
from radish.stepregistry import step
Expand Down
3 changes: 0 additions & 3 deletions tests/data/radish/terrain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-


from radish import before


Expand Down
Loading

0 comments on commit 564ebdc

Please sign in to comment.