pytest: integration steps & tests of the new components

I need to test out multiple components. such components have tests of their own. Now I have to test that they work in sequence. also, since in some occasions, new data sometimes leads to unforeseen cases (and not usable results – I am a data scientist). most of these times these cases were not tested "per se" but there is a test that, if run, will spot the problem (i.e.: I tested x**2<100 for x=1/2/3/4/5, now in the data I get x=100).

So basically while I concatenate the output of these tests, I also want to run the individual tests of each component with the in-memory data that are run. I am using pytest as testing framework.

logically:

def integrate_test_1(a, b, c):
    output_1 = component_1(a)
    # run all the tests of component_1 with a
    
    output_2 = component_2(b, output_1)
    # run all the tests of component_2 with b, output_1

    output_3 = component_3(c, output_1)
    # run all the tests of component_3 with c, output_1

    return output_1 + output_2 + output_3

now I found this answer here (how to write integration tests using pytest and how to repeat the integration tests) but I am not sure this is the thing I need. Do you know how to do this?

Source: Python Questions

LEAVE A COMMENT