'newrelic.api.memcache_trace', 'newrelic.hooks.datastore_memcache', ] code_coverage = code_coverage_fixture(source=_coverage_source) _default_settings = { 'transaction_tracer.explain_threshold': 0.0, 'transaction_tracer.transaction_threshold': 0.0, 'transaction_tracer.stack_trace_threshold': 0.0, 'debug.log_data_collector_payloads': True, 'debug.record_transaction_failure': True } collector_agent_registration = collector_agent_registration_fixture( app_name='Python Agent Test (datastore_memcache)', default_settings=_default_settings, linked_applications=['Python Agent Test (datastore)']) @pytest.fixture(scope='session') def memcached_multi(): """Generate keys that will go onto different servers""" DB_SETTINGS = memcached_settings() db_servers = ['%s:%s' % (s['host'], s['port']) for s in DB_SETTINGS] clients = [memcache.Client([s]) for s in db_servers] client_all = memcache.Client(db_servers) num_servers = len(db_servers) for try_num in range(10 * num_servers): multi_dict = {}
_default_settings = { "transaction_tracer.explain_threshold": 0.0, "transaction_tracer.transaction_threshold": 0.0, "transaction_tracer.stack_trace_threshold": 0.0, "debug.log_data_collector_payloads": True, "debug.record_transaction_failure": True, "debug.log_autorum_middleware": True, "agent_limits.errors_per_harvest": 100, "distributed_tracing.enabled": True, "infinite_tracing.trace_observer_host": "nr-internal.aws-us-east-2.tracing.staging-edge.nr-data.net", "debug.connect_span_stream_in_developer_mode": True, } collector_agent_registration = collector_agent_registration_fixture( app_name="Python Agent Test (agent_streaming)", default_settings=_default_settings ) @pytest.fixture(scope="module") def grpc_app_server(): port = random.randint(50000, 50099) with MockExternalgRPCServer(port=port) as server: yield server, port @pytest.fixture(scope="module") def mock_grpc_server(grpc_app_server): from _test_handler import HANDLERS server, port = grpc_app_server
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pytest from testing_support.fixtures import (code_coverage_fixture, collector_agent_registration_fixture, collector_available_fixture) _coverage_source = [ 'newrelic.hooks.component_tastypie', ] code_coverage = code_coverage_fixture(source=_coverage_source) _default_settings = { 'transaction_tracer.explain_threshold': 0.0, 'transaction_tracer.transaction_threshold': 0.0, 'transaction_tracer.stack_trace_threshold': 0.0, 'debug.log_data_collector_payloads': True, 'debug.record_transaction_failure': True, 'debug.log_autorum_middleware': True, } collector_agent_registration = collector_agent_registration_fixture( app_name='Python Agent Test (component_tastypie)', default_settings=_default_settings)
from testing_support.fixtures import (code_coverage_fixture, collector_agent_registration_fixture, collector_available_fixture) _coverage_source = [ 'newrelic.hooks.framework_flask', ] code_coverage = code_coverage_fixture(source=_coverage_source) _default_settings = { 'transaction_tracer.explain_threshold': 0.0, 'transaction_tracer.transaction_threshold': 0.0, 'transaction_tracer.stack_trace_threshold': 0.0, 'debug.log_data_collector_payloads': True, 'debug.record_transaction_failure': True, 'debug.log_autorum_middleware': True, } collector_agent_registration = collector_agent_registration_fixture( app_name='Python Agent Test (framework_flask)', default_settings=_default_settings) is_flask_v2 = int(flask_version.split('.')[0]) >= 2 is_pypy = platform.python_implementation() == "PyPy" async_handler_support = is_flask_v2 and not is_pypy skip_if_not_async_handler_support = pytest.mark.skipif( not async_handler_support, reason="Requires async handler support. (Flask >=v2.0.0)", )
from testing_support.fixtures import (code_coverage_fixture, collector_agent_registration_fixture, collector_available_fixture) from testing_support.mock_external_http_server import ( MockExternalHTTPHResponseHeadersServer) _coverage_source = [ 'newrelic.hooks.external_httplib2', ] code_coverage = code_coverage_fixture(source=_coverage_source) _default_settings = { 'transaction_tracer.explain_threshold': 0.0, 'transaction_tracer.transaction_threshold': 0.0, 'transaction_tracer.stack_trace_threshold': 0.0, 'debug.log_data_collector_payloads': True, 'debug.record_transaction_failure': True, } collector_agent_registration = collector_agent_registration_fixture( app_name='Python Agent Test (external_httplib2)', default_settings=_default_settings) @pytest.fixture(scope='session') def server(): with MockExternalHTTPHResponseHeadersServer() as _server: yield _server
] code_coverage = code_coverage_fixture(source=_coverage_source) _default_settings = { 'transaction_tracer.explain_threshold': 0.0, 'transaction_tracer.transaction_threshold': 0.0, 'transaction_tracer.stack_trace_threshold': 0.0, 'debug.log_data_collector_payloads': True, 'debug.record_transaction_failure': True, 'debug.log_autorum_middleware': True, 'agent_limits.errors_per_harvest': 100, } collector_agent_registration = collector_agent_registration_fixture( app_name='Python Agent Test (agent_features)', default_settings=_default_settings) @pytest.fixture(scope='session') def session_initialization(code_coverage, collector_agent_registration): pass @pytest.fixture(scope='function') def requires_data_collector(collector_available_fixture): pass if six.PY2: collect_ignore = [
method="POST", path="/agent_listener/invoke_raw_method", *args, **kwargs): path = "https://" + self._host + path return super(FullUriClient, self).send_request(method, path, *args, **kwargs) _default_settings = { "debug.log_data_collector_payloads": True, "debug.record_transaction_failure": True, "startup_timeout": 10.0, } application = collector_agent_registration_fixture( app_name="Python Agent Test (test_full_uri_payloads)", default_settings=_default_settings, ) @pytest.fixture def session(application): session = application._agent.application(application.name)._active_session return session NOW = time.time() EMPTY_SAMPLES = { "reservoir_size": 100, "events_seen": 0, }
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pytest from testing_support.fixtures import (code_coverage_fixture, collector_agent_registration_fixture, collector_available_fixture) _coverage_source = [ 'newrelic.hooks.application_celery', ] code_coverage = code_coverage_fixture(source=_coverage_source) _default_settings = { 'transaction_tracer.explain_threshold': 0.0, 'transaction_tracer.transaction_threshold': 0.0, 'transaction_tracer.stack_trace_threshold': 0.0, 'debug.log_data_collector_payloads': True, 'debug.record_transaction_failure': True, } collector_agent_registration = collector_agent_registration_fixture( app_name='Python Agent Test (application_celery)', default_settings=_default_settings)