Skip to content

Fix electron analyser regions not accepting field names#1995

Merged
oliwenmandiamond merged 14 commits intomainfrom
Fix_electron_analyser_regions_not_accepting_field_names
May 7, 2026
Merged

Fix electron analyser regions not accepting field names#1995
oliwenmandiamond merged 14 commits intomainfrom
Fix_electron_analyser_regions_not_accepting_field_names

Conversation

@oliwenmandiamond
Copy link
Copy Markdown
Contributor

Fixes #1994

Instructions to reviewer on how to test:

  1. Check tests pass

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • If a new device has been added does it follow the standards
  • If changing the API for a pre-existing device, ensure that any beamlines using this device have updated their Bluesky plans accordingly
  • Have the connection tests for the relevant beamline(s) been run via dodal connect ${BEAMLINE}

@oliwenmandiamond oliwenmandiamond requested a review from a team as a code owner March 27, 2026 12:22
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (553594d) to head (c324fc6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1995      +/-   ##
==========================================
- Coverage   99.11%   99.11%   -0.01%     
==========================================
  Files         327      327              
  Lines       12814    12810       -4     
==========================================
- Hits        12701    12697       -4     
  Misses        113      113              

☔ 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.

Comment thread tests/devices/electron_analyser/vgscienta/test_vgscienta_region.py Outdated
Comment thread tests/devices/electron_analyser/vgscienta/test_vgscienta_region.py
Comment thread tests/devices/electron_analyser/specs/test_specs_region.py Outdated
@Villtord
Copy link
Copy Markdown
Contributor

Tests pytest --no-cov tests/devices/electron_analyser/ pass, but at the end I get

================================================================ 155 passed in 2.35s =================================================================
Future exception was never retrieved
future: <Future finished exception=FailedStatus(<AsyncStatus, device: ew4000-driver-detector_mode, task: <coroutine object AsyncStatusBase.__init__.<locals>.wait_with_error_message at 0x7f48b64fa140>, errored: ValueError("<DetectorModeTestEnum.TEST_1: 'INVALID_DETECTOR_MODE'> is not a valid DetectorMode")>)>

@oliwenmandiamond
Copy link
Copy Markdown
Contributor Author

pytest --no-cov tests/devices/electron_analyser/

are you sure it isn't something to do with your env? I can't replicate and is fine for me

$ pytest --no-cov tests/devices/electron_analyser/
============================================================================ test session starts ============================================================================
platform linux -- Python 3.11.14, pytest-9.0.2, pluggy-1.6.0 -- /cache/venv-for/scratch/bluesky_development/dodal/bin/python3
cachedir: .pytest_cache
Test order randomisation NOT enabled. Enable with --random-order or --random-order-bucket=<bucket_type>
metadata: {'Python': '3.11.14', 'Platform': 'Linux-4.18.0-553.105.1.el8_10.x86_64-x86_64-with-glibc2.39', 'Packages': {'pytest': '9.0.2', 'pluggy': '1.6.0'}, 'Plugins': {'json-report': '1.5.0', 'random-order': '1.2.0', 'timeout': '2.4.0', 'anyio': '4.12.1', 'asyncio': '1.3.0', 'cov': '7.0.0', 'metadata': '3.1.1'}}
rootdir: /workspaces/dodal
configfile: pyproject.toml
plugins: json-report-1.5.0, random-order-1.2.0, timeout-2.4.0, anyio-4.12.1, asyncio-1.3.0, cov-7.0.0, metadata-3.1.1
timeout: 1.0s
timeout method: signal
timeout func_only: False
asyncio: mode=Mode.AUTO, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 155 items                                                                                                                                                         

tests/devices/electron_analyser/base/test_base_controller.py::test_controller_prepare_sets_excitation_energy[ew4000] PASSED                                           [  0%]
tests/devices/electron_analyser/base/test_base_controller.py::test_controller_prepare_sets_excitation_energy[b07b_specs150] PASSED                                    [  1%]
tests/devices/electron_analyser/base/
...
tests/devices/electron_analyser/vgscienta/test_vgscienta_region.py::test_load_sequence_using_alias_field_names_has_expected_enabled_region_names PASSED               [ 98%]
tests/devices/electron_analyser/vgscienta/test_vgscienta_region.py::test_load_sequence_using_alias_field_names_has_expected_values PASSED                             [ 99%]
tests/devices/electron_analyser/vgscienta/test_vgscienta_region.py::test_region_loads_using_field_names_has_expected_values PASSED                                    [100%]

============================================================================ 155 passed in 3.90s ============================================================================
root ➜ /workspaces/dodal (Fix_electron_analyser_regions_not_accepting_field_names) 

@Villtord
Copy link
Copy Markdown
Contributor

yes it was old container image, gone after rebuild.

Comment thread src/dodal/devices/electron_analyser/base/base_region.py Outdated
inherit this to extend functionality. All energy units are assumed to be in eV.
"""

model_config = ConfigDict(populate_by_name=True)
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.

SO that is the core change if I get it right? the rest is renaming and also you added test case for alias/field names loading.

…' of ssh://github.com/DiamondLightSource/dodal into Fix_electron_analyser_regions_not_accepting_field_names
@oliwenmandiamond oliwenmandiamond merged commit 4ba9de1 into main May 7, 2026
10 checks passed
@oliwenmandiamond oliwenmandiamond deleted the Fix_electron_analyser_regions_not_accepting_field_names branch May 7, 2026 09:39
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.

Electron analyser regions don't accept original field name, only alias

2 participants