-
Notifications
You must be signed in to change notification settings - Fork 168
Refactoring test fixtures #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
^ do we not want this to trigger the test failing - or is it the idea that only the game construction tests in I like the Also just noting that when I work on the game library idea #623 then games can be removed from the test dir completely and loaded directly from the library, however that ends up looking. |
They will still fail - but they will fail when the test is run. In our current test suite, if something causes game construction to fail, this fails at test collection time - so no tests run. |
A related point is that in the test suite we now use a mixture of .nfg and .efg files and functions in games.py that create a Gambit game object. Ted made the good point that we don't want one of those functions in games.py failing to bring down all tests. In addition, some of these functions do quite non-trivial things and we could easily break them in a way that they still run but do not produce the correct game. Presumably often this would then break some tests, but still I think Ted and I agree that a better way to go would likely be:
One implication is that some things in the game library will be good for testing certain aspects of Gambit, but may not be of as much general interest as others, but that seems fine, as we will be explaining the relevance of all games in the library anyway. |
|
Yes. Games will be "interesting" for different reasons:
In terms of designing our dataset of games, we probably don't want to distinguish at the dataset level too much among these different types of example (because some will fit more than one category). Where they'll be distinguished is more in the user-facing documentation/tutorials - for example the first type of game would appear in examples/tutorials for domain applications, the second more for game-theory teaching, the final group more in more technical algorithmic examples... |
d-kad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with this, I will refactor (i) reachability, (ii) perfect recall, (iii) WIP subgame root tests to use the dataclass and factory pattern
Trying to understand the output from the failing Nash equilibrium tests recently just about did my head in, so I decided it was high time that we really need to look at our tests. So I pulled together a bunch of notes/thoughts I had been having (alongside reading up on some
pytestfeatures)..This draft pull request is a proposal for discussion.
In short - I have re-written what used to be the test for
enummixed_solvewith rational probabilities to be a generic Nash equilibrium solver tester (!!!)Highlights:
dataclasstest1,test2&c right now, they will need to be better in production of course.pytest-subtests(which has been added as a dependency in the testsrequirements.txt). This allows us to isolate the individual checks within the test so even if one fails the others can still run - e.g. if somehowmax_regretis correct but the probabilities change for one profile, it still will check them all.Q()as a shorthand for rationals just to make our intent precise, and a helperd()which visually represents a probability distribution - solely for visual layout so we are not lost in a maze of square brackets, all alike.This is an all hands request for everyone to have a look. Not least because in the new year I will be asking everyone to kick in for rationalising our test suite using either this technique or some other one - it is clear our test suite's reaching the edge of maintainability without making some investments like the ones suggested here!