Information for Developers¶
Compiling the documentation¶
To build the documentation, run the following command:
sphinx-build -M html docs/source/ docs/build/
or in docs
:
make html
Adding new patterns¶
Create a new module for the model in
coarnotify.models
(for examplecoarnotify.models.announce_ingest
)Create the new model class in the new module (for example,
AnnounceIngest
) and implement as neededReview the validation requirements of the new model and ensure validation is updated (update the model spreadsheet)
Add the new model to
coarnotify.models.__init__.py
so it can be imported fromcoarnotify.models
Add the new model to the factory list of models in
coarnotify.factory.COARNotifyFactory.MODELS
Create a fixture and fixture factory in
coarnotify.test.fixtures
(for example,coarnotify.test.fixtures.announce_ingest
)Import the new fixture in
coarnotify.test.fixtures.__init__.py
Add a unit test for the new model in
coarnotify.test.unit.test_models
, and confirm it worksAdd a unit test for the model factory in
coarnotify.test.unit.test_factory
, and confirm it worksAdd an integration test for the new model in
coarnotify.test.integration.test_client
, and confirm it worksAdd validation tests for the new model in
coarnotify.test.unit.test_validate
, and confirm they work
Testing¶
Unit¶
Unit tests are located in coarnotify.test.unit
and can be run with the following command (or your preferred test runner):
pytest coarnotify/test/unit
Integration¶
Integration tests require a notify inbox to be available
This can be done by starting the test inbox server. To do this you will first need to configure your local settings for the server.
Default configuration is in coarnotify/test/server/settings.py
and can be overridden by providing your own settings file as an environment variable COARNOTIFY_SETTINGS
.
The main things you may wish to override are:
STORE_DIR: the directory to store the notifications. You MUST supply your own path
PORT: the port to run the server on. Default is 5005
Create a local config file called something like local.cfg
containing those properties
STORE_DIR = '/path/to/store/notifications'
PORT = 5005
Then start the server with the following command:
COARNOTIFY_SETTINGS=local.cfg; python coarnotify/test/server/inbox.py
Integration tests are located in coarnotify/test/integration
and can be run with the following command (or your preferred test runner):
pytest coarnotify/test/integration
Making a release¶
Update the version number in
setup.py
andcoarnotify/__init__.py
Update references in
README.md
andindex.rst
to the appropriate specification version if neededMake the release in github, with the version number as the tag
Build the package locally:
python -m pip install build twine
python -m build
twine check dist/*
Test upload the package to TestPypi (you will need an account on https://test.pypi.org and to set up an API token):
twine upload -r testpypi dist/*
Do the release to the real Pypi:
twine upload dist/*