Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid reimporting modules #1080

Merged
merged 3 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ disable=print-statement,
W0201,
W0212,
W0221,
W0404,
W0612,
W0613,
W0621,
Expand Down
2 changes: 0 additions & 2 deletions esrally/chart_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,8 +1625,6 @@ def add_race_configs(license_configs, flavor_name, track_name):
track_name))

if chart_spec_path:
import json

race_configs = {"oss": [], "default": []}
if chart_type == BarCharts:
race_configs = []
Expand Down
8 changes: 2 additions & 6 deletions tests/driver/driver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from datetime import datetime
from unittest import TestCase

import elasticsearch

from esrally import metrics, track, exceptions, config
from esrally.driver import driver, runner
from esrally.track import params
Expand Down Expand Up @@ -1405,7 +1407,6 @@ async def test_execute_single_dict(self):

@run_async
async def test_execute_single_with_connection_error_aborts_as_fatal(self):
import elasticsearch
es = None
params = None
# ES client uses pseudo-status "N/A" in this case...
Expand All @@ -1419,7 +1420,6 @@ async def test_execute_single_with_connection_error_aborts_as_fatal(self):

@run_async
async def test_execute_single_with_connection_error_continues(self):
import elasticsearch
es = None
params = None
# ES client uses pseudo-status "N/A" in this case...
Expand All @@ -1441,7 +1441,6 @@ async def test_execute_single_with_connection_error_continues(self):

@run_async
async def test_execute_single_with_http_400(self):
import elasticsearch
es = None
params = None
runner = mock.Mock(side_effect=
Expand All @@ -1461,7 +1460,6 @@ async def test_execute_single_with_http_400(self):

@run_async
async def test_execute_single_with_http_413(self):
import elasticsearch
es = None
params = None
runner = mock.Mock(side_effect=
Expand Down Expand Up @@ -1505,8 +1503,6 @@ def __str__(self):
class AsyncProfilerTests(TestCase):
@run_async
async def test_profiler_is_a_transparent_wrapper(self):
import time

async def f(x):
await asyncio.sleep(x)
return x * 2
Expand Down
9 changes: 0 additions & 9 deletions tests/driver/runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,6 @@ async def test_scroll_query_with_explicit_number_of_pages(self, es):
@mock.patch("elasticsearch.Elasticsearch")
@run_async
async def test_scroll_query_cannot_clear_scroll(self, es):
import elasticsearch
# page 1
search_response = {
"_scroll_id": "some-scroll-id",
Expand Down Expand Up @@ -3801,8 +3800,6 @@ async def test_is_transparent_on_success_when_no_retries(self):

@run_async
async def test_is_transparent_on_exception_when_no_retries(self):
import elasticsearch

delegate = mock.Mock(side_effect=as_future(exception=elasticsearch.ConnectionError("N/A", "no route to host")))
es = None
params = {
Expand Down Expand Up @@ -3849,8 +3846,6 @@ async def test_is_does_not_retry_on_success(self):

@run_async
async def test_retries_on_timeout_if_wanted_and_raises_if_no_recovery(self):
import elasticsearch

delegate = mock.Mock(side_effect=[
as_future(exception=elasticsearch.ConnectionError("N/A", "no route to host")),
as_future(exception=elasticsearch.ConnectionError("N/A", "no route to host")),
Expand All @@ -3877,7 +3872,6 @@ async def test_retries_on_timeout_if_wanted_and_raises_if_no_recovery(self):

@run_async
async def test_retries_on_timeout_if_wanted_and_returns_first_call(self):
import elasticsearch
failed_return_value = {"weight": 1, "unit": "ops", "success": False}

delegate = mock.Mock(side_effect=[
Expand Down Expand Up @@ -3905,7 +3899,6 @@ async def test_retries_on_timeout_if_wanted_and_returns_first_call(self):

@run_async
async def test_retries_mixed_timeout_and_application_errors(self):
import elasticsearch
connection_error = elasticsearch.ConnectionError("N/A", "no route to host")
failed_return_value = {"weight": 1, "unit": "ops", "success": False}
success_return_value = {"weight": 1, "unit": "ops", "success": False}
Expand Down Expand Up @@ -3948,8 +3941,6 @@ async def test_retries_mixed_timeout_and_application_errors(self):

@run_async
async def test_does_not_retry_on_timeout_if_not_wanted(self):
import elasticsearch

delegate = mock.Mock(side_effect=as_future(exception=elasticsearch.ConnectionTimeout(408, "timed out")))
es = None
params = {
Expand Down
3 changes: 0 additions & 3 deletions tests/track/loader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,9 +1228,6 @@ def as_track(self, track_specification, track_params=None, complete_track_params
class TrackPathTests(TestCase):
@mock.patch("os.path.exists")
def test_sets_absolute_path(self, path_exists):
from esrally import config
from esrally.track import track

path_exists.return_value = True

cfg = config.Config()
Expand Down