Testing and logging

Running the unit tests and enabling debug logging.

Testing the Python code

You can test the library by installing the extra test dependencies:

  1. Create a venv to isolate the python install: python -m venv venvTest

  2. Install BIOMERO with test dependencies: venvTest/Scripts/python -m pip install .[test]

  3. Run pytest from this venv: venvTest/Scripts/pytest

Logging

Debug logging can be enabled with the standard python logging module, for example with logging.basicConfig():

import logging

logging.basicConfig(level='DEBUG')

For example in (the __init__ of) a script:

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO,
                        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                        stream=sys.stdout)
    runScript()