I know that similar questions has been asked here, but I still think I'm missing something here.
Let's say I have a class implementing an algorithm that requires training and evaluation steps. Thus, let's consider 3 tests:
- "test_allocation"
- "test_train"
- "test_eval".
These are sequential and hence, it'll be useless (impossible) to run one if the previous has failed. (If it helps, I'm thinking on pattern recognition algorithms)
Here they suggested to alter the internal state of the object so that "test_eval" can be executed even if "test_train" has failed. I understand and agree with this. However, there're cases where this is not really possible/practical, e.g. if the training process implements a really complex algorithm (am I supposed to take my calculator out and do all the maths by hard!? No, thank you).
The most reasonable answer I have found to my question is this, which is implemented on pytest. Solved! Not really :-( Now, the problem I've encountered is: how do I pass the results of "test_train" to "test_eval".
Setting the object as a class property doesn't seem to work (testing methods can't modify properties "?" Or they can but changes don't materialize outside the function. OR I'm doing something wrong here). Then... the only solution I can think of is to allocate the object externally (global variable), but this doesn't seem elegant to me.
What am I missing here?
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire