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:
Create a venv to isolate the python install:
python -m venv venvTestInstall BIOMERO with test dependencies:
venvTest/Scripts/python -m pip install .[test]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()