Repository navigation
Failures with Python 3.8 #755
Copy link
Copy link
Closed
Description
In Fedora, we have the following failures with behave 1.2.6 and Python 3.8.0b1:
==================================== ERRORS ====================================
_ ERROR at setup of TestCaptureController.test_capturing__retrieve_captured_several_times _
@pytest.fixture
def capture_controller():
"""Provides a capture_controller that is already setup and automatically
performs a teardown afterwards.
"""
capture_controller = create_capture_controller()
> setup_capture_controller(capture_controller)
tests/unit/test_capture.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit/test_capture.py:30: in setup_capture_controller
capture_controller.setup_capture(context)
behave/capture.py:147: in setup_capture
self.log_capture = LoggingCapture(self.config)
behave/log_capture.py:74: in __init__
formatter = logging.Formatter(log_format, datefmt)
/usr/lib64/python3.8/logging/__init__.py:576: in __init__
self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <logging.PercentStyle object at 0x7f4272b01700>
def validate(self):
"""Validate the input format, ensure it matches the correct style"""
> if not self.validation_pattern.search(self._fmt):
E TypeError: expected string or bytes-like object
/usr/lib64/python3.8/logging/__init__.py:428: TypeError
_ ERROR at setup of TestCaptureController.test_capturing__with_several_start_stop_cycles _
@pytest.fixture
def capture_controller():
"""Provides a capture_controller that is already setup and automatically
performs a teardown afterwards.
"""
capture_controller = create_capture_controller()
> setup_capture_controller(capture_controller)
tests/unit/test_capture.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit/test_capture.py:30: in setup_capture_controller
capture_controller.setup_capture(context)
behave/capture.py:147: in setup_capture
self.log_capture = LoggingCapture(self.config)
behave/log_capture.py:74: in __init__
formatter = logging.Formatter(log_format, datefmt)
/usr/lib64/python3.8/logging/__init__.py:576: in __init__
self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <logging.PercentStyle object at 0x7f4271516190>
def validate(self):
"""Validate the input format, ensure it matches the correct style"""
> if not self.validation_pattern.search(self._fmt):
E TypeError: expected string or bytes-like object
/usr/lib64/python3.8/logging/__init__.py:428: TypeError
_______ ERROR at setup of TestCaptureController.test_make_capture_report _______
@pytest.fixture
def capture_controller():
"""Provides a capture_controller that is already setup and automatically
performs a teardown afterwards.
"""
capture_controller = create_capture_controller()
> setup_capture_controller(capture_controller)
tests/unit/test_capture.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/unit/test_capture.py:30: in setup_capture_controller
capture_controller.setup_capture(context)
behave/capture.py:147: in setup_capture
self.log_capture = LoggingCapture(self.config)
behave/log_capture.py:74: in __init__
formatter = logging.Formatter(log_format, datefmt)
/usr/lib64/python3.8/logging/__init__.py:576: in __init__
self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <logging.PercentStyle object at 0x7f4271520100>
def validate(self):
"""Validate the input format, ensure it matches the correct style"""
> if not self.validation_pattern.search(self._fmt):
E TypeError: expected string or bytes-like object
/usr/lib64/python3.8/logging/__init__.py:428: TypeError
=================================== FAILURES ===================================
____________ TestRunWithPaths.test_loads_hooks_and_step_definitions ____________
self = <test.test_runner.TestRunWithPaths testMethod=test_loads_hooks_and_step_definitions>
def test_loads_hooks_and_step_definitions(self):
self.feature_locations.return_value = []
> self.runner.run_with_paths()
test/test_runner.py:678:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
behave/runner.py:824: in run_with_paths
return self.run_model()
behave/runner.py:613: in run_model
self.setup_capture()
behave/runner.py:590: in setup_capture
self.capture_controller.setup_capture(self.context)
behave/capture.py:147: in setup_capture
self.log_capture = LoggingCapture(self.config)
behave/log_capture.py:74: in __init__
formatter = logging.Formatter(log_format, datefmt)
/usr/lib64/python3.8/logging/__init__.py:576: in __init__
self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <logging.PercentStyle object at 0x7f4272ac0610>
def validate(self):
"""Validate the input format, ensure it matches the correct style"""
> if not self.validation_pattern.search(self._fmt):
E TypeError: expected string or bytes-like object
/usr/lib64/python3.8/logging/__init__.py:428: TypeError
____ TestRunWithPaths.test_parses_feature_files_and_appends_to_feature_list ____
self = <test.test_runner.TestRunWithPaths testMethod=test_parses_feature_files_and_appends_to_feature_list>
abspath = <MagicMock name='abspath' id='139923345085536'>
parse_file = <MagicMock name='parse_file' id='139923345946176'>
@patch("behave.parser.parse_file")
@patch("os.path.abspath")
def test_parses_feature_files_and_appends_to_feature_list(self, abspath,
parse_file):
feature_locations = ["one", "two", "three"]
feature = Mock()
feature.tags = []
feature.__iter__ = Mock(return_value=iter([]))
feature.run.return_value = False
self.runner.feature_locations.return_value = feature_locations
abspath.side_effect = lambda x: x.upper()
self.config.lang = "fritz"
self.config.format = ["plain"]
self.config.outputs = [StreamOpener(stream=sys.stdout)]
self.config.output.encoding = None
self.config.exclude = lambda s: False
self.config.junit = False
self.config.summary = False
parse_file.return_value = feature
> self.runner.run_with_paths()
test/test_runner.py:717:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
behave/runner.py:824: in run_with_paths
return self.run_model()
behave/runner.py:613: in run_model
self.setup_capture()
behave/runner.py:590: in setup_capture
self.capture_controller.setup_capture(self.context)
behave/capture.py:147: in setup_capture
self.log_capture = LoggingCapture(self.config)
behave/log_capture.py:74: in __init__
formatter = logging.Formatter(log_format, datefmt)
/usr/lib64/python3.8/logging/__init__.py:576: in __init__
self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <logging.PercentStyle object at 0x7f4272a95d00>
def validate(self):
"""Validate the input format, ensure it matches the correct style"""
> if not self.validation_pattern.search(self._fmt):
E TypeError: expected string or bytes-like object
/usr/lib64/python3.8/logging/__init__.py:428: TypeError
__________ TestRunWithPaths.test_runs_before_all_and_after_all_hooks ___________
self = <test.test_runner.TestRunWithPaths testMethod=test_runs_before_all_and_after_all_hooks>
def test_runs_before_all_and_after_all_hooks(self):
# Make runner.feature_locations() and runner.run_hook() the same mock so
# we can make sure things happen in the right order.
self.runner.feature_locations = self.run_hook
self.runner.feature_locations.return_value = []
self.runner.context = Mock()
> self.runner.run_with_paths()
test/test_runner.py:689:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
behave/runner.py:824: in run_with_paths
return self.run_model()
behave/runner.py:613: in run_model
self.setup_capture()
behave/runner.py:590: in setup_capture
self.capture_controller.setup_capture(self.context)
behave/capture.py:147: in setup_capture
self.log_capture = LoggingCapture(self.config)
behave/log_capture.py:74: in __init__
formatter = logging.Formatter(log_format, datefmt)
/usr/lib64/python3.8/logging/__init__.py:576: in __init__
self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <logging.PercentStyle object at 0x7f4271395e20>
def validate(self):
"""Validate the input format, ensure it matches the correct style"""
> if not self.validation_pattern.search(self._fmt):
E TypeError: expected string or bytes-like object
/usr/lib64/python3.8/logging/__init__.py:428: TypeError
______________________ TestCaptureController.test_basics _______________________
self = <tests.unit.test_capture.TestCaptureController object at 0x7f4271439880>
def test_basics(self):
capture_controller = create_capture_controller()
context = Mock()
context.aborted = False
context.config = capture_controller.config
> capture_controller.setup_capture(context)
tests/unit/test_capture.py:226:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
behave/capture.py:147: in setup_capture
self.log_capture = LoggingCapture(self.config)
behave/log_capture.py:74: in __init__
formatter = logging.Formatter(log_format, datefmt)
/usr/lib64/python3.8/logging/__init__.py:576: in __init__
self._style.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <logging.PercentStyle object at 0x7f42719918b0>
def validate(self):
"""Validate the input format, ensure it matches the correct style"""
> if not self.validation_pattern.search(self._fmt):
E TypeError: expected string or bytes-like object
/usr/lib64/python3.8/logging/__init__.py:428: TypeError
Full log: builder.log
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
tirkarthi commentedon Jun 8, 2019
Seems to be due to python/cpython#9703 . Formatter could pass
validate=Falseto have the old behavior but it be good to have this fixed instead of restoring the older behavior.jenisys commentedon Jun 9, 2019
Partially fixed (on current HEAD), meaning unit test suite runs again without errors:
Other issues (warnings, ...) still need to be addressed.
UPDATE: Add #755 info
UPDATE: Mark issue #755 as fixed.
jenisys commentedon Jul 7, 2019
INTEGRATED INTO: behave-1.2.7.dev1
mbanck commentedon Jan 24, 2020
What is the commit that fixed this? There does not seem to have been a stable release since, so distribution will have to cherry-pick this in order to support behave on python3.8.
hroncok commentedon Jan 24, 2020
https://src.fedoraproject.org/rpms/python-behave/blob/master/f/0001-Backport-for-py38-fixes.patch
Cherry picked from commits:
83906ba
ce8f2ed
e69d28e
c000c88
mbanck commentedon Jan 24, 2020
Cool! Many thanks!