From b9c2ac7f3c0a1aaf9b32faf537ce6913659d8722 Mon Sep 17 00:00:00 2001 From: Jacob Fiola Date: Wed, 28 Feb 2024 09:34:11 -0700 Subject: [PATCH] The Ruffening (#36) --- .coveragerc | 8 -- .flake8 | 8 -- .github/workflows/quality-checks.yml | 79 +++------------- .gitignore | 3 +- .pydocstyle | 3 - .tox/.pkg/file.lock | 0 example/test_example.py | 3 +- pre-commit | 33 ++----- pyproject.toml | 89 +++++++++++++++---- requirements-dev.txt | 13 --- requirements.txt | 11 --- src/grasshopper/lib/fixtures/__init__.py | 3 +- src/grasshopper/lib/grasshopper.py | 5 +- src/grasshopper/lib/journeys/base_journey.py | 3 +- .../reporting/er_basic_console_reporter.py | 3 +- src/grasshopper/lib/util/launch.py | 3 +- src/grasshopper/lib/util/listeners.py | 7 +- src/grasshopper/lib/util/utils.py | 3 +- tests/integration/test__journey1.py | 3 +- tests/unit/test__er_basic_console_reporter.py | 1 - tests/unit/test__fixture__cmdln_args.py | 8 +- tests/unit/test__fixture__env_var_args.py | 8 +- .../unit/test__fixture__env_var_extra_keys.py | 8 +- tests/unit/test__fixture__global_defaults.py | 9 +- .../unit/test__fixture__pre_processed_args.py | 4 +- tests/unit/test__reporter_extensions.py | 3 +- tests/unit/test__shared_reporting.py | 1 - ...st_BaseJourney.py => test_base_journey.py} | 3 +- tests/unit/test_metrics.py | 5 +- tests/unit/test_utils.py | 3 +- 30 files changed, 130 insertions(+), 203 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .flake8 delete mode 100644 .pydocstyle create mode 100644 .tox/.pkg/file.lock delete mode 100644 requirements-dev.txt delete mode 100644 requirements.txt rename tests/unit/{test_BaseJourney.py => test_base_journey.py} (99%) diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index b20538e..0000000 --- a/.coveragerc +++ /dev/null @@ -1,8 +0,0 @@ -# .coveragerc to control coverage.py -[run] -branch = True -omit = - */tests/* -[paths] -source = - /grasshopper/* diff --git a/.flake8 b/.flake8 deleted file mode 100644 index b3d693e..0000000 --- a/.flake8 +++ /dev/null @@ -1,8 +0,0 @@ -[flake8] -ignore = E203, W503 -max-line-length = 88 -max-complexity = 18 -exclude=data-files,docs,.git,__pycache__,venv -application_import_names = grasshopper -import_order_style = pep8 -application-import-names = grasshopper, src diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 3ce1232..ef39e46 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -3,7 +3,7 @@ name: quality checks on: push jobs: - black-lint: + ruff-lint: if: "!contains(github.event.head_commit.message, '[ci skip]')" runs-on: ubuntu-latest steps: @@ -13,75 +13,22 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.10" - - run: pip install -r requirements-dev.txt - - run: black . --check - flake8-lint: + - run: pip install -e ".[dev]" + - run: ruff check . + unit-test: if: "!contains(github.event.head_commit.message, '[ci skip]')" + needs: [ruff-lint] runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] steps: - name: Check out source repository uses: actions/checkout@v3 - - name: Set up Python environment - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - run: pip install -r requirements-dev.txt - - run: flake8 . - pydocstyle-lint: - if: "!contains(github.event.head_commit.message, '[ci skip]')" - runs-on: ubuntu-latest - steps: - - name: Check out source repository - uses: actions/checkout@v3 - - name: Set up Python environment - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - run: pip install -r requirements-dev.txt - - run: pydocstyle src - unit-test-python-310: - if: "!contains(github.event.head_commit.message, '[ci skip]')" - needs: [black-lint, flake8-lint, pydocstyle-lint] - runs-on: ubuntu-latest - steps: - - name: Check out source repository - uses: actions/checkout@v3 - - name: Set up Python environment - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - run: pip install -r requirements.txt - - run: pip install -r requirements-dev.txt - - run: pip install -e . - - run: coverage run -a -m pytest tests/unit - unit-test-python-311: - if: "!contains(github.event.head_commit.message, '[ci skip]')" - needs: [ black-lint, flake8-lint, pydocstyle-lint ] - runs-on: ubuntu-latest - steps: - - name: Check out source repository - uses: actions/checkout@v3 - - name: Set up Python environment - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - run: pip install -r requirements.txt - - run: pip install -r requirements-dev.txt - - run: pip install -e . - - run: coverage run -a -m pytest tests/unit - unit-test-python-312: - if: "!contains(github.event.head_commit.message, '[ci skip]')" - needs: [ black-lint, flake8-lint, pydocstyle-lint ] - runs-on: ubuntu-latest - steps: - - name: Check out source repository - uses: actions/checkout@v3 - - name: Set up Python environment - uses: actions/setup-python@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 with: - python-version: "3.12" - - run: pip install -r requirements.txt - - run: pip install -r requirements-dev.txt - - run: pip install -e . - - run: coverage run -a -m pytest tests/unit + python-version: ${{ matrix.python-version }} + - run: pip install tox + - run: tox diff --git a/.gitignore b/.gitignore index b8ba815..5bde209 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,5 @@ __pycache__ # don't include log files or anything else generated by running *.log .coverage -coverage.* \ No newline at end of file +coverage.* +reports/junit_test_results.xml diff --git a/.pydocstyle b/.pydocstyle deleted file mode 100644 index 249a71d..0000000 --- a/.pydocstyle +++ /dev/null @@ -1,3 +0,0 @@ -[pydocstyle] -convention = numpy -ignore-decorators= (property|pytest.fixture|locator) \ No newline at end of file diff --git a/.tox/.pkg/file.lock b/.tox/.pkg/file.lock new file mode 100644 index 0000000..e69de29 diff --git a/example/test_example.py b/example/test_example.py index e59030b..665b907 100644 --- a/example/test_example.py +++ b/example/test_example.py @@ -1,10 +1,9 @@ import logging -from locust import between, task - from grasshopper.lib.grasshopper import Grasshopper from grasshopper.lib.journeys.base_journey import BaseJourney from grasshopper.lib.util.utils import check +from locust import between, task logger = logging.getLogger(__name__) diff --git a/pre-commit b/pre-commit index 3d32e70..5094412 100644 --- a/pre-commit +++ b/pre-commit @@ -1,14 +1,13 @@ #!/bin/sh -# Verify that paths in index (i.e. files being committed) comply -# with the pipeline codestyle checks and create a commit +# Verify that paths in index (i.e. files being committed) comply +# with the pipeline codestyle checks and create a commit # only if all checks pass # https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203 -files_changed=$(git diff --diff-filter=ACM --cached --name-only -- "*.py" "requirements*.txt") +files_changed=$(git diff --diff-filter=ACM --cached --name-only -- "*.py") files_change_py=$(git diff --diff-filter=ACM --cached --name-only -- "*.py") files_changed_no_tests=$(git diff --diff-filter=ACM --cached --name-only -- "*.py" | grep -ve "test_[^\\\/]\+\.py") -files_change_requirements=$(git diff --diff-filter=ACM --cached --name-only -- "requirements*.txt") exit_on_error() { exit_code=$1 @@ -22,32 +21,14 @@ exit_on_error() { [ -z "$files_changed" ] && exit 0 if [ -n "$files_change_py" ]; then - echo "Sorting imports with isort..." - isort $files_change_py + echo "Checking ruff..." + ruff check --fix $files_change_py exit_on_error $? fi if [ -n "$files_change_py" ]; then - echo "Formatting with black..." - black $files_change_py - exit_on_error $? -fi - -if [ -n "$files_change_py" ]; then - echo "Checking flake8..." - flake8 $files_change_py - exit_on_error $? -fi - -if [ -n "$files_change_requirements" ]; then - echo "Sorting requirements files..." - sort-requirements $files_change_requirements - exit_on_error $? -fi - -if [ -n "$files_changed_no_tests" ]; then - echo "Checking pydocstyle..." - pydocstyle $files_changed_no_tests + echo "Formatting with ruff..." + ruff format $files_change_py exit_on_error $? fi diff --git a/pyproject.toml b/pyproject.toml index 6c7fc5a..9e6350c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=42", "wheel", "cmake>=3.11.0,<4.0.0"] +requires = ["setuptools", "setuptools-scm"] build-backend = "setuptools.build_meta" [project] @@ -40,26 +40,83 @@ dependencies = [ "termcolor ~= 1.1.0", ] +[project.optional-dependencies] +dev = [ + # Testing stuff + "assertpy==1.1", + "pytest-cov==4.0.0", + "pytest-mock==3.10.0", + "requests-mock==1.11.0", + "tox==4.13.0", + + # Linting and formatting + "ruff==0.2.2", +] + [project.urls] "repository" = "https://github.com/alteryx/locust-grasshopper" [tool.setuptools.packages.find] where = ["src"] -[tool.isort] -profile = "black" -known_local_folder = [ - "grasshopper" +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-rap --junitxml=reports/junit_test_results.xml --cov=src --cov-report=html --cov-report=xml --cov-report=term" +testpaths = [ + "tests/unit", ] -multi_line_output = 3 -atomic = "True" -honor_noqa = "True" -include_trailing_comma = "True" -force_grid_wrap = "0" -use_parentheses = "True" -ensure_newline_before_comments = "True" -line_length = "88" -treat_all_comments_as_code = "True" - -[tool.black] +junit_suite_name = "locust-grasshopper" +log_level = "INFO" +xfail_strict = "True" +log_cli = "True" +log_cli_level = "INFO" +log_cli_format = "%(asctime)s [%(levelname)s] %(module)s:%(filename)s:%(lineno)s %(message)s" +log_file = "tests.log" +log_file_level = "DEBUG" +log_file_format = "%(asctime)s [%(levelname)s] %(module)s:%(filename)s:%(lineno)s %(message)s" +log_file_date_format = "%m-%d-%Y %H:%M:%S" + +[tool.tox] +legacy_tox_ini = """ + [tox] + min_version = 4.0 + env_list = + py310 + py311 + py312 + + [testenv] + deps = .[dev] + commands = pytest tests/unit +""" + +[tool.ruff] +exclude = ["data-files", "docs", ".git", "__pycache__", "venv"] +src = ["src/*", "tests/unit/*"] +show-fixes = true line-length = 88 + +[tool.ruff.lint] + +# Adds Pyflakes, Mccabe, Pydocstyle, etc. run `ruff linter` to see all available linters +extend-select = ["F", "C90", "I", "N", "ICN"] +ignore = [ "N801", "N803", "N806", "N815", "N818", "E721"] + +# Allows a single underscore to be an unused variable +dummy-variable-rgx = "^_$" + +[tool.ruff.lint.mccabe] +max-complexity = 18 + +[tool.ruff.format] + +[tool.ruff.lint.isort] +# order-by-type = false +section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] + +[tool.ruff.lint.pydocstyle] +convention = "numpy" +ignore-decorators = ["property", "pytest.fixture", "locator"] + + + diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index efdb187..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,13 +0,0 @@ -assertpy==1.0 -black==22.3.0 -bump2version==1.0.1 -click==8.1.3 -coverage==6.3.2 -flake8==6.0.0 -flake8-import-order==0.18.2 -isort==5.11.3 -pep8==1.7.1 -pep8-naming==0.13.3 -pydocstyle==6.1.1 -sort-requirements==1.3.0 -twine==4.0.2 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 0739cd0..0000000 --- a/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -gevent==23.9.1 -influxdb==5.3.1 -locust==2.21.0 -locust-influxdb-listener==1.0.2 -pytest>=6.2.5 -pyyaml>=5.4.1 -tag-matcher==0.0.5 -termcolor==1.1.0 - - - diff --git a/src/grasshopper/lib/fixtures/__init__.py b/src/grasshopper/lib/fixtures/__init__.py index 5f084f3..b3201be 100644 --- a/src/grasshopper/lib/fixtures/__init__.py +++ b/src/grasshopper/lib/fixtures/__init__.py @@ -11,7 +11,6 @@ import pytest import tagmatcher import yaml - from grasshopper.lib.configuration.gh_configuration import ( ConfigurationConstants, GHConfiguration, @@ -586,7 +585,7 @@ def fetch_value_from_multiple_sources(sources, key): def type_check_list_of_strs(list_of_strs): """Return True if list of strings or [], false if anything else.""" check_passed = False - if type(list_of_strs) == list: + if type(list_of_strs) == (list): all_strs = True for s in list_of_strs: all_strs = all_strs and type(s) == str diff --git a/src/grasshopper/lib/grasshopper.py b/src/grasshopper/lib/grasshopper.py index 26f897b..d23f408 100644 --- a/src/grasshopper/lib/grasshopper.py +++ b/src/grasshopper/lib/grasshopper.py @@ -15,11 +15,10 @@ import gevent import locust -from locust import LoadTestShape -from locust.env import Environment - from grasshopper.lib.journeys.base_journey import BaseJourney from grasshopper.lib.util.listeners import GrasshopperListeners +from locust import LoadTestShape +from locust.env import Environment logger = logging.getLogger() diff --git a/src/grasshopper/lib/journeys/base_journey.py b/src/grasshopper/lib/journeys/base_journey.py index c0835a2..280f6ad 100644 --- a/src/grasshopper/lib/journeys/base_journey.py +++ b/src/grasshopper/lib/journeys/base_journey.py @@ -9,10 +9,9 @@ from uuid import uuid4 import gevent -from locust import HttpUser - import grasshopper.lib.util.listeners # noqa: F401 from grasshopper.lib.fixtures.grasshopper_constants import GrasshopperConstants +from locust import HttpUser class BaseJourney(HttpUser): diff --git a/src/grasshopper/lib/reporting/er_basic_console_reporter.py b/src/grasshopper/lib/reporting/er_basic_console_reporter.py index 02fa07f..d674c5b 100644 --- a/src/grasshopper/lib/reporting/er_basic_console_reporter.py +++ b/src/grasshopper/lib/reporting/er_basic_console_reporter.py @@ -7,10 +7,9 @@ import logging from typing import Any, Dict -from locust import env as locust_environment - from grasshopper.lib.reporting.iextendedreporter import IExtendedReporter from grasshopper.lib.reporting.shared_reporting import SharedReporting +from locust import env as locust_environment logger = logging.getLogger() logger.propagate = True diff --git a/src/grasshopper/lib/util/launch.py b/src/grasshopper/lib/util/launch.py index a2c37ae..a90c06f 100644 --- a/src/grasshopper/lib/util/launch.py +++ b/src/grasshopper/lib/util/launch.py @@ -5,10 +5,9 @@ """ import logging -from locust.env import Environment - from grasshopper.lib.grasshopper import Grasshopper from grasshopper.lib.util.decorators import deprecate +from locust.env import Environment logger = logging.getLogger() diff --git a/src/grasshopper/lib/util/listeners.py b/src/grasshopper/lib/util/listeners.py index 1ab7631..5a819d9 100644 --- a/src/grasshopper/lib/util/listeners.py +++ b/src/grasshopper/lib/util/listeners.py @@ -5,15 +5,14 @@ import logging from datetime import datetime -from locust import events -from locust.env import Environment -from locust_influxdb_listener import InfluxDBListener, InfluxDBSettings - from grasshopper.lib.util.check_constants import CheckConstants from grasshopper.lib.util.utils import ( report_checks_to_console, report_thresholds_to_console, ) +from locust import events +from locust.env import Environment +from locust_influxdb_listener import InfluxDBListener, InfluxDBSettings logger = logging.getLogger() diff --git a/src/grasshopper/lib/util/utils.py b/src/grasshopper/lib/util/utils.py index 15915ff..8835b41 100644 --- a/src/grasshopper/lib/util/utils.py +++ b/src/grasshopper/lib/util/utils.py @@ -9,9 +9,8 @@ import time from datetime import datetime -from termcolor import colored - from grasshopper.lib.util.check_constants import CheckConstants +from termcolor import colored logger = logging.getLogger() diff --git a/tests/integration/test__journey1.py b/tests/integration/test__journey1.py index 2d98322..370642f 100644 --- a/tests/integration/test__journey1.py +++ b/tests/integration/test__journey1.py @@ -1,9 +1,8 @@ import logging -from locust import between, task - from grasshopper.lib.grasshopper import BaseJourney, Grasshopper from grasshopper.lib.util.utils import custom_trend +from locust import between, task logger = logging.getLogger(__name__) diff --git a/tests/unit/test__er_basic_console_reporter.py b/tests/unit/test__er_basic_console_reporter.py index edc0986..018893c 100644 --- a/tests/unit/test__er_basic_console_reporter.py +++ b/tests/unit/test__er_basic_console_reporter.py @@ -3,7 +3,6 @@ import pytest from assertpy import assert_that - from grasshopper.lib.reporting.er_basic_console_reporter import ERBasicConsoleReporter from grasshopper.lib.util.utils import epoch_time diff --git a/tests/unit/test__fixture__cmdln_args.py b/tests/unit/test__fixture__cmdln_args.py index 7a9676d..1a354ec 100644 --- a/tests/unit/test__fixture__cmdln_args.py +++ b/tests/unit/test__fixture__cmdln_args.py @@ -1,5 +1,9 @@ from unittest.mock import patch +from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 + ConfigurationConstants as CC, +) + from tests.unit.conftest import ( CONFTEST_TEMPLATE, PYFILE_ASSERT_EMPTY_CONFIG, @@ -8,10 +12,6 @@ perform_fixture_test_with_optional_log_capture, ) -from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 - ConfigurationConstants as CC, -) - FIXTURE_UNDER_TEST = "cmdln_args" # Some comments on testing fixture cmdln_args. diff --git a/tests/unit/test__fixture__env_var_args.py b/tests/unit/test__fixture__env_var_args.py index 06d1c03..4086f0e 100644 --- a/tests/unit/test__fixture__env_var_args.py +++ b/tests/unit/test__fixture__env_var_args.py @@ -1,6 +1,10 @@ import os from unittest.mock import patch +from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 + ConfigurationConstants as CC, +) + # Alteryx Packages from tests.unit.conftest import ( CONFTEST_TEMPLATE, @@ -10,10 +14,6 @@ perform_fixture_test_with_optional_log_capture, ) -from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 - ConfigurationConstants as CC, -) - FIXTURE_UNDER_TEST = "env_var_args" # Some comments on testing fixture env_var_args. diff --git a/tests/unit/test__fixture__env_var_extra_keys.py b/tests/unit/test__fixture__env_var_extra_keys.py index 06d1c03..4086f0e 100644 --- a/tests/unit/test__fixture__env_var_extra_keys.py +++ b/tests/unit/test__fixture__env_var_extra_keys.py @@ -1,6 +1,10 @@ import os from unittest.mock import patch +from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 + ConfigurationConstants as CC, +) + # Alteryx Packages from tests.unit.conftest import ( CONFTEST_TEMPLATE, @@ -10,10 +14,6 @@ perform_fixture_test_with_optional_log_capture, ) -from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 - ConfigurationConstants as CC, -) - FIXTURE_UNDER_TEST = "env_var_args" # Some comments on testing fixture env_var_args. diff --git a/tests/unit/test__fixture__global_defaults.py b/tests/unit/test__fixture__global_defaults.py index c89d211..b22b1f3 100644 --- a/tests/unit/test__fixture__global_defaults.py +++ b/tests/unit/test__fixture__global_defaults.py @@ -1,6 +1,10 @@ from unittest.mock import patch from assertpy import assert_that +from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 + ConfigurationConstants as CC, +) +from grasshopper.lib.configuration.gh_configuration import GHConfiguration # Alteryx Packages # alias to make patches easier to read @@ -12,11 +16,6 @@ perform_fixture_test_with_optional_log_capture, ) -from grasshopper.lib.configuration.gh_configuration import ( # noqa: N817 - ConfigurationConstants as CC, -) -from grasshopper.lib.configuration.gh_configuration import GHConfiguration - FIXTURE_UNDER_TEST = "global_defaults" ATTRS_WITH_NO_DEFAULTS = { diff --git a/tests/unit/test__fixture__pre_processed_args.py b/tests/unit/test__fixture__pre_processed_args.py index 345571a..0fc12d0 100644 --- a/tests/unit/test__fixture__pre_processed_args.py +++ b/tests/unit/test__fixture__pre_processed_args.py @@ -1,3 +1,5 @@ +from grasshopper.lib.configuration.gh_configuration import GHConfiguration + from tests.unit.conftest import ( CONFTEST_TEMPLATE, PYFILE_ASSERT_EMPTY_CONFIG, @@ -6,8 +8,6 @@ perform_fixture_test_with_optional_log_capture, ) -from grasshopper.lib.configuration.gh_configuration import GHConfiguration - FIXTURE_UNDER_TEST = "pre_processed_args" diff --git a/tests/unit/test__reporter_extensions.py b/tests/unit/test__reporter_extensions.py index ffaf410..0089553 100644 --- a/tests/unit/test__reporter_extensions.py +++ b/tests/unit/test__reporter_extensions.py @@ -2,13 +2,12 @@ import pytest from assertpy import assert_that -from locust import env as locust_environment - from grasshopper.lib.reporting.reporter_extensions import ( IExtendedReporter, ReporterExtensions, ) from grasshopper.lib.util.utils import epoch_time +from locust import env as locust_environment @pytest.fixture(scope="function", autouse=True) diff --git a/tests/unit/test__shared_reporting.py b/tests/unit/test__shared_reporting.py index e234d5e..1f4f445 100644 --- a/tests/unit/test__shared_reporting.py +++ b/tests/unit/test__shared_reporting.py @@ -1,6 +1,5 @@ import pytest from assertpy import assert_that - from grasshopper.lib.reporting.shared_reporting import SharedReporting diff --git a/tests/unit/test_BaseJourney.py b/tests/unit/test_base_journey.py similarity index 99% rename from tests/unit/test_BaseJourney.py rename to tests/unit/test_base_journey.py index 3c465d1..53282f2 100644 --- a/tests/unit/test_BaseJourney.py +++ b/tests/unit/test_base_journey.py @@ -2,9 +2,8 @@ from unittest.mock import MagicMock import pytest - -from grasshopper.lib.journeys.base_journey import BaseJourney from grasshopper.lib.fixtures.grasshopper_constants import GrasshopperConstants +from grasshopper.lib.journeys.base_journey import BaseJourney @pytest.fixture(scope="function", autouse=True) diff --git a/tests/unit/test_metrics.py b/tests/unit/test_metrics.py index 485d933..62885fd 100644 --- a/tests/unit/test_metrics.py +++ b/tests/unit/test_metrics.py @@ -2,11 +2,10 @@ from uuid import uuid4 import pytest -from locust.env import Environment -from locust.stats import RequestStats - from grasshopper.lib.journeys.base_journey import BaseJourney from grasshopper.lib.util.metrics import count_iterations, task +from locust.env import Environment +from locust.stats import RequestStats @pytest.fixture(scope="session") diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 6691915..ebc45be 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -2,8 +2,6 @@ from unittest.mock import MagicMock import pytest -from termcolor import colored - from grasshopper.lib.fixtures.grasshopper_constants import GrasshopperConstants from grasshopper.lib.util.check_constants import CheckConstants from grasshopper.lib.util.listeners import GrasshopperListeners @@ -16,6 +14,7 @@ report_checks_to_console, report_thresholds_to_console, ) +from termcolor import colored @pytest.fixture