Skip to content
Advertisement

unit testing with pytest parametrize

I have the following test code:

JavaScript

This is not my real test this is just a minimal reproduce example.

I need to parameterised only the input which is checked against the same code.

For some reason this doesn’t work I always get:

JavaScript

How can I fix it?

Advertisement

Answer

You can’t use @pytest.mark.parametrize on unittest.TestCase methods. PyTest has no way to pass in the parameter.

Just do:

JavaScript
Advertisement