aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_base.py (follow)
Commit message (Collapse)AuthorAgeLines
* Migrate to `bot.log.get_logger` functionGravatar Izan2021-10-14-6/+5
|
* Modify log test regex to be non-os-specificGravatar S. Co12020-03-01-1/+1
| | | Previous regex utilized a `/`, which doesn't work for comparing against Windows paths, which use `\`
* Use realistic mixin implementationGravatar Sebastiaan Zeeff2020-02-24-1/+1
| | | | Instead of using the mixin class bare, I've now included into a class tha subclasses unittest.TestCase as that's how it's going to be used "in the wild".
* Use mixin-composition not inheritance for LoggingTestCaseGravatar Sebastiaan Zeeff2020-02-23-12/+6
| | | | | | We used inheritence to add additional logging assertion methods to unittest's TestCase class. However, with the introduction of the new IsolatedAsyncioTestCase this extension strategy means we'd have to create multiple child classes to be able to use the extended functionality in all of the TestCase variants. Since that leads to undesirable code reuse and an inheritance relationship is not at all needed, I've switched to a mixin-composition based approach that allows the user to extend the functionality of any TestCase variant with a mixin where needed.
* Add tests for tests.baseGravatar Sebastiaan Zeeff2019-10-11-1/+31
| | | | | | | | | | | I forgot to test some aspects of the `tests.base` module, including some branches of the `self.assertNotLogs` method. I've corrected that by including a couple of tests. I also removed the test result publishing from the Azure pipeline, since I've not configured an XML test runner yet. The coverage report is still published, of course and test output will be available in standard out, so information is readily available.
* Migrate pytest to unittestGravatar Sebastiaan Zeeff2019-10-11-0/+61
After a discussion in the core developers channel, we have decided to migrate from `pytest` to `unittest` as the testing framework. This commit sets up the repository to use `unittest` and migrates the first couple of tests files to the new framework. What I have done to migrate to `unitest`: - Removed all `pytest` test files, since they are incompatible. - Removed `pytest`-related dependencies from the Pipfile. - Added `coverage.py` to the Pipfile dev-packages and relocked. - Added convenience scripts to Pipfile for running the test suite. - Adjust to `azure-pipelines.yml` to use `coverage.py` and `unittest`. - Migrated four test files from `pytest` to `unittest` format. In addition, I've added five helper Mock subclasses in `helpers.py` and created a `TestCase` subclass in `base.py` to add an assertion that asserts that no log records were logged within the context of the context manager. Obviously, these new utility functions and classes are fully tested in their respective `test_` files. Finally, I've started with an introductory guide for writing tests for our bot in `README.md`.