Skip to content

Commit

Permalink
[Mega-Linter] Apply linters fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
umaannamalai authored and github-actions[bot] committed Aug 2, 2023
1 parent aa96d5f commit 9f10798
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 13 deletions.
49 changes: 39 additions & 10 deletions tests/agent_features/test_datastore_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from newrelic.api.background_task import background_task
from newrelic.api.datastore_trace import DatastoreTrace, DatastoreTraceWrapper
from testing_support.validators.validate_datastore_trace_inputs import (
validate_datastore_trace_inputs,
)

from newrelic.api.background_task import background_task
from newrelic.api.datastore_trace import DatastoreTrace, DatastoreTraceWrapper

@validate_datastore_trace_inputs(operation='test_operation', target='test_target', host='test_host', port_path_or_id='test_port', database_name='test_db_name')

@validate_datastore_trace_inputs(
operation="test_operation",
target="test_target",
host="test_host",
port_path_or_id="test_port",
database_name="test_db_name",
)
@background_task()
def test_dt_trace_all_args():
with DatastoreTrace(product='Agent Features', target='test_target', operation='test_operation', host='test_host', port_path_or_id='test_port', database_name='test_db_name'):
with DatastoreTrace(
product="Agent Features",
target="test_target",
operation="test_operation",
host="test_host",
port_path_or_id="test_port",
database_name="test_db_name",
):
pass


Expand All @@ -39,22 +53,37 @@ def product_callable():
return "Agent Features"

def target_callable():
return 'test_target'
return "test_target"

def operation_callable():
return "test_operation"

def host_callable():
return 'test_host'
return "test_host"

def port_path_id_callable():
return 'test_port'
return "test_port"

def db_name_callable():
return 'test_db_name'
return "test_db_name"

@validate_datastore_trace_inputs(operation='test_operation', target='test_target', host='test_host', port_path_or_id='test_port', database_name='test_db_name')
@validate_datastore_trace_inputs(
operation="test_operation",
target="test_target",
host="test_host",
port_path_or_id="test_port",
database_name="test_db_name",
)
def _test():
pass
wrapped_fn = DatastoreTraceWrapper(_test, product=product_callable, target=target_callable, operation=operation_callable, host=host_callable, port_path_or_id=port_path_id_callable, database_name=db_name_callable)

wrapped_fn = DatastoreTraceWrapper(
_test,
product=product_callable,
target=target_callable,
operation=operation_callable,
host=host_callable,
port_path_or_id=port_path_id_callable,
database_name=db_name_callable,
)
wrapped_fn()
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ def _bind_params(product, target, operation, host=None, port_path_or_id=None, da
if host is not None:
assert host == host, "%s didn't match expected %s" % (captured_host, host)
if port_path_or_id is not None:
assert captured_port_path_or_id == port_path_or_id, "%s didn't match expected %s" % (captured_port_path_or_id, port_path_or_id)
assert captured_port_path_or_id == port_path_or_id, "%s didn't match expected %s" % (
captured_port_path_or_id,
port_path_or_id,
)
if database_name is not None:
assert captured_database_name == database_name, "%s didn't match expected %s" % (captured_database_name, database_name)

assert captured_database_name == database_name, "%s didn't match expected %s" % (
captured_database_name,
database_name,
)

return wrapped(*args, **kwargs)

Expand Down

0 comments on commit 9f10798

Please sign in to comment.