<commit_before>[tox]
envlist = lint,py{2.7}-unit-tests
skipsdist = true
# NOTE: We pass the TERM env to preserve colors
passenv = TERM XDG_CACHE_HOME
setenv =
  PY_COLORS=1

[testenv]
basepython =
    {py2.7-unit-tests,py2.7-smoke-tests,coverage}: python2.7
    {py3.5-unit-tests,py3.5-smoke-tests}: python3.5
    {py3.6-unit-tests,py3.6-smoke-tests,lint,black,modernize,flake8,pylint,mypy,generate-monitor-docs}: python3.6
    {lint,black,modernize,flake8,pylint,mypy}: {env:LINT_PYTHON_BINARY}
    {py3.7-unit-tests,py3.7-smoke-tests}: python3.7
    {py3.8-unit-tests,py3.8-smoke-tests}: python3.8
# NOTE: We pass the TERM env to preserve colors
passenv = TERM XDG_CACHE_HOME
setenv =
  LINT_FILES_TO_CHECK={env:LINT_FILES_TO_CHECK:*.py scripts/*.py benchmarks/scripts/*.py tests/ pylint_plugins/*.py .circleci/*.py .circleci/modernize/ scalyr_agent/ scalyr_agent/third_party/tcollector/}
  # Which Python binary to use for various lint targets
  LINT_PYTHON_BINARY={env:LINT_PYTHON_BINARY:python3.6}
  PYTHONPATH={toxinidir}
  PY_COLORS=1
install_command = pip install -U --force-reinstall {opts} {packages}
deps =
    -r dev-requirements.txt
whitelist_externals =
    rm
    bash
commands =
    # NOTE: We run memory leak tests separately so they run in a separate
    # process and are isolated from other tests
    py.test scalyr_agent/tests scalyr_agent/builtin_monitors/tests -vv --durations=5 -m "not memory_leak and not json_lib"
    py.test scalyr_agent/tests/test_memory_leaks.py -vv --durations=5
    py.test scalyr_agent/tests/util/json_util_test.py -vv --durations=5 -m "json_lib"

# Target which generates documentation for all the monitors
[testenv:generate-monitor-docs]
deps =
    -r dev-requirements.txt
whitelist_externals =
    bash
commands =
    bash -c "scripts/generate-docs-for-all-monitors.sh"

# NOTE: Older version of tox which still supports Python 2.6 doesn't support installing
# requirements from a file so we need to declare them inline
# In addition to that, we need to use older versions of some of the libraries
# (importlib, pytest, etc.)
# We can get rid of this once we drop Python 2.6 support.
[testenv:py2.6-unit-tests]
basepython = python2.6
install_command = pip install -U --force-reinstall {opts} {packages}
deps = -rpy26-unit-tests-requirements.txt
commands =
    py.test scalyr_agent/tests scalyr_agent/builtin_monitors/tests -vv --durations=5 -m "not memory_leak and not json_lib"
    py.test scalyr_agent/tests/util/json_util_test.py -vv --durations=5 -m "json_lib"

# Lint target which runs all the linting tools such as black, modernize, pylint, flake8, mypy, etc.
# NOTE: We use bash -c since we don't want tox to quote all the arguments, we want globs to
# be expaded
# NOTE: If you update any of the lint targets or the lint target itself, make sure you also update
# corresponding pre commit hook configuration in .pre-commit-config.yaml
[testenv:lint]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
    -r tests/ami/requirements.txt
commands =
    bash -c 'black --check --config pyproject.toml {env:LINT_FILES_TO_CHECK}'
    python .circleci/modernize/modernize.py -j 2
    bash -c 'flake8 --config lint-configs/python/.flake8 {env:LINT_FILES_TO_CHECK}'
    bash -c 'pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins pylint_plugins.bundled_imports_checker {env:LINT_FILES_TO_CHECK}'
    bash -c 'mypy --pretty --no-incremental --config-file ./lint-configs/python/mypy.ini {env:LINT_FILES_TO_CHECK}'

[testenv:black]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
commands =
    bash -c 'black --check --config pyproject.toml {env:LINT_FILES_TO_CHECK}'

[testenv:modernize]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
commands =
    python .circleci/modernize/modernize.py -j 2

[testenv:flake8]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
commands =
    bash -c 'flake8 --config lint-configs/python/.flake8 {env:LINT_FILES_TO_CHECK}'

[testenv:pylint]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
commands =
    bash -c 'pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins pylint_plugins.bundled_imports_checker {env:LINT_FILES_TO_CHECK}'
<commit_msg>Fix missing dependency causing pylint to fail (#508)<commit_after>[tox]
envlist = lint,py{2.7}-unit-tests
skipsdist = true
# NOTE: We pass the TERM env to preserve colors
passenv = TERM XDG_CACHE_HOME
setenv =
  PY_COLORS=1

[testenv]
basepython =
    {py2.7-unit-tests,py2.7-smoke-tests,coverage}: python2.7
    {py3.5-unit-tests,py3.5-smoke-tests}: python3.5
    {py3.6-unit-tests,py3.6-smoke-tests,lint,black,modernize,flake8,pylint,mypy,generate-monitor-docs}: python3.6
    {lint,black,modernize,flake8,pylint,mypy}: {env:LINT_PYTHON_BINARY}
    {py3.7-unit-tests,py3.7-smoke-tests}: python3.7
    {py3.8-unit-tests,py3.8-smoke-tests}: python3.8
# NOTE: We pass the TERM env to preserve colors
passenv = TERM XDG_CACHE_HOME
setenv =
  LINT_FILES_TO_CHECK={env:LINT_FILES_TO_CHECK:*.py scripts/*.py benchmarks/scripts/*.py tests/ pylint_plugins/*.py .circleci/*.py .circleci/modernize/ scalyr_agent/ scalyr_agent/third_party/tcollector/}
  # Which Python binary to use for various lint targets
  LINT_PYTHON_BINARY={env:LINT_PYTHON_BINARY:python3.6}
  PYTHONPATH={toxinidir}
  PY_COLORS=1
install_command = pip install -U --force-reinstall {opts} {packages}
deps =
    -r dev-requirements.txt
whitelist_externals =
    rm
    bash
commands =
    # NOTE: We run memory leak tests separately so they run in a separate
    # process and are isolated from other tests
    py.test scalyr_agent/tests scalyr_agent/builtin_monitors/tests -vv --durations=5 -m "not memory_leak and not json_lib"
    py.test scalyr_agent/tests/test_memory_leaks.py -vv --durations=5
    py.test scalyr_agent/tests/util/json_util_test.py -vv --durations=5 -m "json_lib"

# Target which generates documentation for all the monitors
[testenv:generate-monitor-docs]
deps =
    -r dev-requirements.txt
whitelist_externals =
    bash
commands =
    bash -c "scripts/generate-docs-for-all-monitors.sh"

# NOTE: Older version of tox which still supports Python 2.6 doesn't support installing
# requirements from a file so we need to declare them inline
# In addition to that, we need to use older versions of some of the libraries
# (importlib, pytest, etc.)
# We can get rid of this once we drop Python 2.6 support.
[testenv:py2.6-unit-tests]
basepython = python2.6
install_command = pip install -U --force-reinstall {opts} {packages}
deps = -rpy26-unit-tests-requirements.txt
commands =
    py.test scalyr_agent/tests scalyr_agent/builtin_monitors/tests -vv --durations=5 -m "not memory_leak and not json_lib"
    py.test scalyr_agent/tests/util/json_util_test.py -vv --durations=5 -m "json_lib"

# Lint target which runs all the linting tools such as black, modernize, pylint, flake8, mypy, etc.
# NOTE: We use bash -c since we don't want tox to quote all the arguments, we want globs to
# be expaded
# NOTE: If you update any of the lint targets or the lint target itself, make sure you also update
# corresponding pre commit hook configuration in .pre-commit-config.yaml
[testenv:lint]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
    -r tests/ami/requirements.txt
commands =
    bash -c 'black --check --config pyproject.toml {env:LINT_FILES_TO_CHECK}'
    python .circleci/modernize/modernize.py -j 2
    bash -c 'flake8 --config lint-configs/python/.flake8 {env:LINT_FILES_TO_CHECK}'
    bash -c 'pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins pylint_plugins.bundled_imports_checker {env:LINT_FILES_TO_CHECK}'
    bash -c 'mypy --pretty --no-incremental --config-file ./lint-configs/python/mypy.ini {env:LINT_FILES_TO_CHECK}'

[testenv:black]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
commands =
    bash -c 'black --check --config pyproject.toml {env:LINT_FILES_TO_CHECK}'

[testenv:modernize]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
commands =
    python .circleci/modernize/modernize.py -j 2

[testenv:flake8]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
commands =
    bash -c 'flake8 --config lint-configs/python/.flake8 {env:LINT_FILES_TO_CHECK}'

[testenv:pylint]
basepython = {env:LINT_PYTHON_BINARY}
deps =
    -r dev-requirements.txt
    -r lint-requirements.txt
    -r benchmarks/scripts/requirements.txt
    -r tests/ami/requirements.txt
commands =
    bash -c 'pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins pylint_plugins.bundled_imports_checker {env:LINT_FILES_TO_CHECK}'

{'fraction_non_alphanumeric': 0.10985132099689807, 'fraction_numerical': 0.01337041394801583, 'mean_word_length': 4.016094420600858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5666808', 'n_tokens_mistral': 3495, 'n_tokens_neox': 3385, 'n_words': 813}