You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We'd like to test if empty or invalid string as license expression raises error.
@pytest.mark.parametrize('lic_expr', ["This is not a list", ])deftest_fail_on_invalid_str_license_expression(parse_simple):
withpytest.raises(FlictError): # FIXME flict does not fail herepass@pytest.mark.parametrize('lic_expr', [[], ])deftest_fail_on_empty_license_expression(parse_simple):
withpytest.raises(FlictError) aserr:
passasserterr.value.code==ReturnCodes.RET_INVALID_EXPRESSSION@pytest.mark.parametrize('lic_expr', [[""], ])deftest_fail_on_empty_str_license_expression(parse_simple):
withpytest.raises(TypeError):
pass
However, given the fixtures there, at the moment it seems to be more complicated to handle raised exceptions within fixture.
Second thing is more of a typical bug - flict, given a normal string to parse - parses it without complains - while it is not a valid license expression string.
I thought about this a bit - what the license parser should do is
remove the brackets as currently implemented
split at AND and OR only
replace WITH statements by -with- (compat db should have entries for that, like GPL-2.0-or-later-with-custom-exception - otherwise it will be hard to automatically check compat with others, as exceptions tend to be a bit random in their scope, so I would suggest to add those edge cases manually to the DB)
throw an error in case any of the items still has a blank in it
We'd like to test if empty or invalid string as license expression raises error.
However, given the fixtures there, at the moment it seems to be more complicated to handle raised exceptions within fixture.
Second thing is more of a typical bug - flict, given a normal string to parse - parses it without complains - while it is not a valid license expression string.
Originally posted by @kkrolczyk in #230 (comment)
The text was updated successfully, but these errors were encountered: