NH-144962 ruff all tests and scripts - #849
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR broadens linting/formatting coverage (Ruff/formatter) to include tests and scripts, and applies consistent formatting updates across the repository’s test suite and helper scripts.
Changes:
- Update Ruff/flake8 configuration so tests/scripts are no longer excluded from linting.
- Apply formatting and small refactors across unit/integration tests and docker install scripts (imports, line wrapping, f-strings, asserts).
- Add a dedicated
tests/unit/test_apm_config/conftest.pyto expose shared fixtures cleanly.
Reviewed changes
Copilot reviewed 60 out of 65 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_xtraceoptions.py | Formatting updates for test style compliance. |
| tests/unit/test_w3c_transformer.py | Formatting + f-string conversions in assertions. |
| tests/unit/test_uams.py | Import ordering + formatting for patched tests. |
| tests/unit/test_transaction_name_pool_api.py | Import ordering and spacing. |
| tests/unit/test_semconv/test_trace.py | Test class naming cleanup + trailing commas. |
| tests/unit/test_semconv/init.py | Header formatting alignment. |
| tests/unit/test_sampler/test_sampler.py | Test style updates (e.g., isinstance). |
| tests/unit/test_sampler/init.py | Header formatting alignment. |
| tests/unit/test_response_propagator.py | Formatting + mock configuration simplification. |
| tests/unit/test_propagator.py | Formatting + mock configuration simplification. |
| tests/unit/test_processors/test_serviceentry_processor.py | Formatting + mock configuration simplification. |
| tests/unit/test_processors/init.py | Header formatting alignment. |
| tests/unit/test_oboe/test_transaction_name_pool.py | Import order + minor expression simplification. |
| tests/unit/test_oboe/test_transaction_name_calculator.py | Formatting long assertion lines. |
| tests/unit/test_oboe/test_trace_options.py | Large formatting pass over parametrized tests. |
| tests/unit/test_oboe/test_token_bucket.py | Formatting changes in concurrency-related tests. |
| tests/unit/test_oboe/test_settings.py | Formatting and line wrapping for flags/settings tests. |
| tests/unit/test_oboe/test_sampler.py | Import ordering + formatting for sampler integration tests. |
| tests/unit/test_oboe/test_json_sampler.py | Formatting + small refactors (e.g., contextlib.suppress). |
| tests/unit/test_oboe/test_http_sampler.py | Import ordering + formatting + small naming cleanups. |
| tests/unit/test_oboe/test_dice.py | Minor boolean assertion simplification. |
| tests/unit/test_k8s.py | Formatting + import order + dict formatting. |
| tests/unit/test_configurator/test_configurator_traces_init.py | Formatting + class definition style updates. |
| tests/unit/test_configurator/test_configurator_span_processors.py | Formatting + patch call cleanup. |
| tests/unit/test_configurator/test_configurator_propagators.py | Formatting + expectation narrowing for failure case. |
| tests/unit/test_configurator/test_configurator_metrics_init.py | Formatting + patch call cleanup. |
| tests/unit/test_configurator/test_configurator_configure_otel.py | Import ordering + whitespace cleanup. |
| tests/unit/test_configurator/fixtures/trace.py | Formatting + mock configuration simplification. |
| tests/unit/test_configurator/fixtures/resource.py | Formatting + mock configuration simplification. |
| tests/unit/test_configurator/fixtures/logging.py | Formatting + mock configuration simplification. |
| tests/unit/test_configurator/conftest.py | Formatting + fixture patch style cleanup. |
| tests/unit/test_apm_resource.py | Formatting + line wrapping for long assertions/calls. |
| tests/unit/test_apm_logging.py | Formatting + string quoting consistency. |
| tests/unit/test_apm_config/test_apm_config_transaction_filters.py | Formatting + dict literal simplification. |
| tests/unit/test_apm_config/test_apm_config_service_name.py | Remove unused fixture imports; formatting improvements. |
| tests/unit/test_apm_config/test_apm_config_cnf_file.py | Remove unused fixture imports; formatting improvements. |
| tests/unit/test_apm_config/test_apm_config_calculate_metrics_enabled.py | Formatting + line wrapping for patch/assert blocks. |
| tests/unit/test_apm_config/test_apm_config_calculate_collector.py | Formatting + line wrapping for patch/assert blocks. |
| tests/unit/test_apm_config/test_apm_config_agent_enabled.py | Remove unused fixture imports; formatting improvements. |
| tests/unit/test_apm_config/fixtures/env_vars.py | Formatting + dict layout for patched env. |
| tests/unit/test_apm_config/fixtures/cnf_file.py | Formatting + spacing cleanup. |
| tests/unit/test_apm_config/fixtures/cnf_dict.py | Formatting + spacing cleanup. |
| tests/unit/test_apm_config/conftest.py | New conftest to expose apm_config fixtures to tests. |
| tests/unit/test_api.py | Formatting + simplify boolean assertions. |
| tests/unit/init.py | Header formatting alignment. |
| tests/integration/test_service_name.py | Formatting + class wrapping for long bases. |
| tests/integration/test_service_instance_id.py | Formatting + long string wrapping. |
| tests/integration/test_scenario_4.py | Formatting + f-string conversions. |
| tests/integration/test_scenario_1.py | Formatting + f-string conversions. |
| tests/integration/test_base_sw_headers_attrs.py | Import ordering + formatting cleanup. |
| tests/integration/init.py | Header formatting alignment. |
| tests/docker/install/client.py | Formatting + safer string formatting in logs/exits. |
| tests/docker/install/app.py | Formatting + wrap long set_attribute call. |
| scripts/lint_and_format.py | Formatting + f-string conversion in error output. |
| pyproject.toml | Ruff configuration updated to include tests/scripts in lint scope. |
| lambda/tests/test_instrumentation.py | Formatting cleanup in lambda instrumentation tests. |
| .flake8 | Stop excluding scripts/ and tests/ from flake8. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tammy-baylis-swi
force-pushed
the
NH-144962-ruff-coverage
branch
from
August 19, 2026 19:47
3268222 to
10000da
Compare
tammy-baylis-swi
marked this pull request as ready for review
August 19, 2026 19:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The key changes here are:
tests/andscripts/from ruff config (pyproject.toml) and pylint config (.flake8) so that they too can be style-checked/fixed quickly during local dev and CI/CD, before agent reviewUP038to ruff "ignore" list because it's been deprecatedThe rest of the changes are to fix the existing style issues in
tests/andscripts/(imports, line lengths, double quotes, name casing, string formatting, commas and whitespaces, etc). Should be a one-time big change, then all code moving forward will be kept in line.