Closed ercaronte closed 4 months ago
Seeing the failing CI tests. There is an API change in the behave Configuration class made on 1.2.7dev1 release. Will see if I can made a fix so that the allure-behave listener supports <=1.2.6 versions as well as the new 1.2.7dev
Added a check on the config class attributes. Maybe not very elegant, but now all tests pass with all non-dev versions of behave.
Not sure who to ask for a review. @skhomuti or @delatrie, maybe you could help?
Hi, @ercaronte ! Thank you for you PR.
We usually only support generally available officially released versions. However, in the case of Behave, making an exception is reasonable since 1.2.7 pre-release versions are somewhat popular, and an alternative is to use six-year-old version 1.2.6.
That said, I suggest to change the version check to be more expressive by utilizing packaging.version
:
import behave
from packaging import version
# ...
if version.parse(behave.__version__) > version.parse("1.2.6"):
# new code
else:
# old code
The check might be slightly optimized by evaluating at the module level:
# ...
BEHAVE_1_2_7_OR_GREATER = version.parse(behave.__version__) > version.parse("1.2.6")
# ...
if BEHAVE_1_2_7_OR_GREATER:
# ...
Hi @delatrie , thank you for your good feedback. I like the proposed changes, they are definitely more expressive in view of future code maintenance changes. I preferred the more optimised version at module level B-)
I tested locally on 1.2.7dev5, and for previous versions the CI tests are passing just fine.
Made the suggested changes, and run the 55 tests of tests/allure_behave
with Behave 1.2.6 and with 1.2.7dev5.
They are passing just fine with both versions.
Of course, without this change with Behave 1.2.7dev5 all tests could not even start because of the matchers
API change from 1.2.7dev4.
Good suggestion!
Nice job! Thank you for your time!
This is a fix for issue https://github.com/allure-framework/allure-python/issues/771: with behave v1.2.7.dev5 an error causes the allure_behave report formatter to crash.
Context
With behave v1.2.7.dev5 the allure-behave python library crashes every run, with exceptions like the following example:
That is a blocker for whoever wants to use allure with behave.
Checklist