A plugin to pytest stoq.
This plugin automatically set up the stoq test environment. It also provide a range of fixtures to ease the testing of stoq-related projects.
You can install "pytest-stoq" via pip from PyPI:
$ pip install pytest-stoq
--plugin-cls
: the plugin class path to be installed. Useful for testing stoq plugin projects.--quick
: setup stoq using the quick strategy.--skip-env-setup
: pytest-stoq won't setup the database, install plugins etc. (in case you already have the test env ready).--stoq-plugins
: a comma-separated list of stoq plugin names to be installed. Useful for testing stoq applications that uses plugins (such as stoq desktop and stoq server).
PLUGIN_CLASS
: same as--plugin-cls
STOQ_PLUGINS
: same as--stoq-plugins
The plugin provides the following fixtures:
store
: an instance of storm's (ORM) store used to access the database. It suffers rollback after each test case and cannot be committed, closed or rollbacked manuallyexample_creator
: instance creates (inserts) database objects with example/test datasysparam
: a sysparam instance that clear its cache automatically after each usecurrent_station
current_user
current_branch
current_till
mock_new_store
: replacestoqlib.api.new_store()
with thestore
fixture
(optional) Setup your virtualenv using python 3.5+
Install test requirements:
$ pip install -Ur requirements-test.txt
Setup pre-commit:
$ pre-commit install
Run tests using pytest:
$ make test
Distributed under the terms of the GNU GPL v3.0 license, "pytest-stoq" is free and open source software