Skip to content

NH-144962 ruff all tests and scripts - #849

Merged
tammy-baylis-swi merged 4 commits into
mainfrom
NH-144962-ruff-coverage
Aug 19, 2026
Merged

NH-144962 ruff all tests and scripts#849
tammy-baylis-swi merged 4 commits into
mainfrom
NH-144962-ruff-coverage

Conversation

@tammy-baylis-swi

@tammy-baylis-swi tammy-baylis-swi commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The key changes here are:

  • Stops excluding tests/ and scripts/ 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 review
  • Adds UP038 to ruff "ignore" list because it's been deprecated

The rest of the changes are to fix the existing style issues in tests/ and scripts/ (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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py to 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.

Comment thread tests/unit/test_oboe/test_token_bucket.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 60 out of 65 changed files in this pull request and generated no new comments.

Comment thread tests/unit/test_apm_config/test_apm_config.py Outdated
@tammy-baylis-swi
tammy-baylis-swi force-pushed the NH-144962-ruff-coverage branch from 3268222 to 10000da Compare August 19, 2026 19:47
@tammy-baylis-swi
tammy-baylis-swi marked this pull request as ready for review August 19, 2026 19:50
@tammy-baylis-swi
tammy-baylis-swi requested review from a team as code owners August 19, 2026 19:50

@cheempz cheempz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tammy-baylis-swi
tammy-baylis-swi merged commit 0f00d4b into main Aug 19, 2026
52 checks passed
@tammy-baylis-swi
tammy-baylis-swi deleted the NH-144962-ruff-coverage branch August 19, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants