The previous style was causing duplicate tests for the dropbox_share bot
for the unittest runner, due to globbing of test_*.py giving duplicates.
However, it also avoids unintentional duplication of bot names to test
on the command line being tested multiple times, though again only with
the unittest runner.
Encountered several issues with test cases initially,
where test cases were failing due to the structure of the tests
within the file. This was circumvented by creating a separate
instance of the class TicTacToeModel for each test case
in order to focus on unit testing. There might be an issue with
the _get_game_handlers() function at the end of the file
which is used to obtain the model and message information,
it seems to be getting the entire class TicTacToeModel instead of
creating an instance of the class. Overall, this commit focuses
on creating a precedent for writing test cases involving TicTacToeModel,
and implements basic cases which can be extended to larger
edge cases in the future. Testing was done locally by running
./tools/test-bots until we were able to get the response 'ok' for
all the test cases written. We also used coverage in order to test the
coverage of the cases. While we were not able to increase
the coverage as much as we would have liked, we were able to
identify several issues and fix them, hopefully making it easier
for future contributors to add additional test cases to TicTacToeModel.
Overall, we would like special attention given to the way
that TicTacToeModel() was initailized in these tests and whether or not
this is a scalable precedent for future tests.
Fixes: #122
The GET /messages action has been recently implemented into our
bindings. Therefore this example has been superseded by get-messages,
which is capable of fetch messages in a more fine-grained way.
* Add pytest to requirements.txt
* Add pass-through option to run pytest in verbose mode
* Use various default pytest options
* Exclude merels bot for now
Previously the test-bots script filtered out base-class tests from
BotTestCase. With this change, BotTestCase continues to inherit from
unittest.TestCase, but the default test_* methods previously in this
class are now in a new DefaultTests class, which does not. Instead, each
bot needs to inherit from BotTestCase and DefaultTests *explicitly*.
This avoids the need to filter out the base-class tests, which
simplifies the test-bots script, and may ease any migration to eg.
pytest.
The DefaultTests class does require some non-implemented methods which
BotTestCase provides.