for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Unit test configuration."""
import os
import logging
import pytest
import yorm
yorm
This can be caused by one of the following:
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
# .scrutinizer.yml before_commands: - sudo pip install abc # Python2 - sudo pip3 install abc # Python3
This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.
__init__.py
ENV = 'TEST_INTEGRATION' # environment variable to enable integration tests
REASON = "'{0}' variable not set".format(ENV)
ROOT = os.path.dirname(__file__)
FILES = os.path.join(ROOT, 'files')
def pytest_configure(config):
"""Conigure logging and silence verbose test runner output."""
logging.basicConfig(
level=logging.DEBUG,
format="[%(levelname)-8s] (%(name)s @%(lineno)4d) %(message)s",
)
logging.getLogger('yorm').setLevel(logging.WARNING)
logging.getLogger('sh').setLevel(logging.WARNING)
terminal = config.pluginmanager.getplugin('terminal')
class QuietReporter(terminal.TerminalReporter):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.verbosity = 0
self.showlongtestinfo = False
self.showfspath = False
terminal.TerminalReporter = QuietReporter
def pytest_runtest_setup(item):
"""Disable YORM file storage during unit tests."""
if 'integration' in item.keywords:
if not os.getenv(ENV):
pytest.skip(REASON)
else:
yorm.settings.fake = False
yorm.settings.fake = True
This can be caused by one of the following:
1. Missing Dependencies
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
2. Missing __init__.py files
This error could also result from missing
__init__.py
files in your module folders. Make sure that you place one file in each sub-folder.