Skip to content

Improve test coverage for Instrument, logger, validators and monitor#7966

Draft
jenshnielsen wants to merge 6 commits intomicrosoft:mainfrom
jenshnielsen:better_coverage_2
Draft

Improve test coverage for Instrument, logger, validators and monitor#7966
jenshnielsen wants to merge 6 commits intomicrosoft:mainfrom
jenshnielsen:better_coverage_2

Conversation

@jenshnielsen
Copy link
Collaborator

@jenshnielsen jenshnielsen commented Mar 24, 2026

On top of #7961 to be merged first

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.55%. Comparing base (3090bab) to head (76f78ce).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7966      +/-   ##
==========================================
+ Coverage   69.97%   70.55%   +0.57%     
==========================================
  Files         333      333              
  Lines       32245    32245              
==========================================
+ Hits        22562    22749     +187     
+ Misses       9683     9496     -187     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jenshnielsen and others added 6 commits March 25, 2026 09:20
…modules

Add 128 new tests across 12 new test files targeting modules that
previously had 0% or very low test coverage (excluding instrument_drivers).

New test files:
- tests/utils/test_types.py: numpy type tuple definitions and composition
- tests/utils/test_abstractmethod.py: qcodes_abstractmethod decorator
- tests/utils/test_deprecate.py: QCoDeSDeprecationWarning class
- tests/utils/test_deep_update_utils.py: recursive dict merging
- tests/utils/test_path_helpers.py: QCoDeS path resolution utilities
- tests/utils/test_numpy_utils.py: ragged array conversion
- tests/dataset/test_snapshot_utils.py: dataset snapshot diffing
- tests/dataset/test_json_exporter.py: JSON linear/heatmap export
- tests/dataset/test_export_config.py: export config get/set functions
- tests/dataset/test_rundescribertypes.py: TypedDict versioned schemas
- tests/dataset/test_sqlite_settings_extended.py: SQLite settings/limits
- tests/test_metadatable_base.py: Metadatable and MetadatableWithName

Non-driver test coverage: 64.7% -> 65.4%

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add 207 new tests across 4 test files targeting modules with coverage
between 43-56% (excluding instrument_drivers).

New test files:
- tests/test_logger_extended.py (28 tests): formatters, level name/code
  conversion, log file generation, LogCapture class, log_to_dataframe,
  logfile_to_dataframe, time_difference with comma separators
- tests/test_config_extended.py (40 tests): DotDict dotted key access,
  nested set/get/contains/del, Config describe/add/getitem/save/load,
  update() recursive merge, schema validation edge cases
- tests/test_monitor_extended.py (12 tests): _get_metadata with/without
  timestamps, unbound parameters, use_root_instrument flag, Monitor.show
- tests/validators/test_validators_extended.py (127 tests): validate_all,
  range_str branches, base Validator, Nothing/Bool/Strings/Enum/OnOff/
  Multiples/PermissiveMultiples/MultiType/MultiTypeOr/MultiTypeAnd/
  Arrays/Lists/Sequence/Callable/Dict edge cases and error paths

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add 217 new tests across 7 test files targeting the largest remaining
coverage gaps in non-driver modules.

Parameters tests (71 tests):
- tests/parameter/test_command_extended.py (17 tests): all call_by_str
  and call_cmd method combinations, arg count validation, NoCommandError
- tests/parameter/test_function_extended.py (16 tests): validation,
  name properties, parsers, callable/string cmd, get_attrs
- tests/parameter/test_grouped_parameter_extended.py (22 tests):
  DelegateGroup set/get with custom setter/getter, source_parameters,
  GroupedParameter repr and properties
- tests/parameter/test_combined_parameter_extended.py (16 tests):
  combine(), aggregator, iter/len, snapshot_base, units deprecation

Instrument core tests (146 tests):
- tests/test_instrument_extended.py: write_raw/ask_raw NotImplementedError,
  close_all, find_instrument, exist/is_valid, repr, label, add_function,
  add_submodule, get_component, print_readable_snapshot, invalidate_cache,
  parent/ancestors/root_instrument, find_or_create_instrument
- tests/test_channel_extended.py: InstrumentModule proxy methods,
  ChannelTuple operations (reversed/contains/add/index/count/get_by_name),
  ChannelList mutations and lock behavior, ChannelTupleValidator
- tests/test_station_extended.py: snapshot_base, add/remove/get component,
  close_all_registered_instruments, Station.default handling

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jenshnielsen jenshnielsen changed the title Better coverage 2 Improve test coverage for Instrument, logger, validators and monitor Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant