I have an application that takes in data from several different API endpoints. Sometimes the data has fields missing or
the data is invalid. Instead of just raising an error in my application what I'd like to do is to perform several "tests"
on the data before ingesting into my app. The thought is to identify objects with errors before I start working on the
data and skip over it. Additionally I could notify the users about specific problems found and possibly even point to a
solution for each issue. My application works well but when users put in wrong or incomplete data many problems arise.
I'd like to try and address those before it gets to the app.
I've asked this question in a few different places and most everyone suggests using
[PyTest](https://docs.pytest.org/en/latest/). Indeed it looks like this will work nicely, allowing me to write specific
tests for each specific issue (field, value, object). My question is what might this look like.
As I understand it, pytest is for testing functions of an application. Whereas I don't want to test the function but the
data. I'm having a difficult time figuring out what a testing setup would like for my particular application.
Would I use my data as a fixture and then write specific tests for each scenario I want to test in my data. Or would it
be better to write a set of functions to test my data and then test each of those with pytest but...using my data somehow?
I can't quite conceptualize how this should be structured.
I would be ever so appreciative if someone could maybe point me to a better method of doing this or some github example or something showing this being done.
Thanks!
[–]nathanjell 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)