Skip to content

metno/met-vocab-tools

Repository files navigation

Met Vocabulary Tools

flake8 pytest codecov

Toolbox for caching and interfacing with vocab.met.no.

Config

A desired path to be used for caching can be provided by the environment variable METVOCAB_CACHEPATH, otherwise a system-specific fallback will be used.

The default maximum age of the cached files before they are downloaded again is 7 days. You can change this limit by setting the METVOCAB_MAXAGE environment variable. Decimal values are allowed. Minimum value is 1 hour.

Debugging

To increase logging level to include info and debug messages, set the environment variable METVOCAB_LOGLEVEL to the desired level. Valid levels are CRITICAL, ERROR, WARNING, INFO, and DEBUG.

Tests

The tests use pytest. To run all tests for all modules, run:

python -m pytest -vv

To add coverage, and to optionally generate a coverage report in XML, run:

python -m pytest -vv --cov=metvocab --cov-report=term --cov-report=xml

Coverage requires the pytest-cov package.

Some of the tests will call the live vocab.met.no API. To disable those tests, add -m 'not live' to the pytest command, like for so:

python -m pytest -vv -m 'not live'