https://github.com/krassowski/anki_testing
A small utility for testing Anki 2.1 addons
https://github.com/krassowski/anki_testing
anki anki-addon anki-testing continuous-integration test-automation testing
Last synced: 3 months ago
JSON representation
A small utility for testing Anki 2.1 addons
- Host: GitHub
- URL: https://github.com/krassowski/anki_testing
- Owner: krassowski
- License: gpl-3.0
- Created: 2017-10-14T12:36:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-15T13:26:11.000Z (about 5 years ago)
- Last Synced: 2025-04-13T04:05:29.457Z (3 months ago)
- Topics: anki, anki-addon, anki-testing, continuous-integration, test-automation, testing
- Language: Python
- Size: 31.3 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Easy testing of Anki add-ons
[](https://travis-ci.org/krassowski/anki_testing)
A small utility for testing Anki 2.1 add-ons.
The code from this repository is used by [Anki-Night-Mode](https://github.com/krassowski/Anki-Night-Mode) and [AwesomeTTS](https://github.com/AwesomeTTS/awesometts-anki-addon).### Usage
1. (Optional) add following to you .gitignore:
```
anki_root
anki_testing
```2. Clone this repository into the root of your add-on repo:
```bash
git clone https://github.com/krassowski/anki_testing
```2. In your tests add:
```python
from anki_testing import anki_runningdef test_my_addon():
with anki_running() as anki_app:
import my_addon
# add some tests in here
```3. Create a testing script which will install Anki and then call your test-runner. For example:
```bash
#!/usr/bin/env bash
bash anki_testing/install_anki.sh
python3 -m pytest tests
```Lets call the file above `run_tests.sh`.
4. (Optional) configure `.travis.yml` using following template:
```yml
language: python
sudo: requiredpython:
- 3.6install:
- git clone https://github.com/krassowski/anki_testing
- source anki_testing/setup.shscript:
- bash run_tests.sh
```