-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update version checking to warn that version is deprecated and error if there is no .serviceconfig version #911
Conversation
…ure that there is a version in the .serviceconfig file
Test Results 40 files ± 0 40 suites ±0 50m 52s ⏱️ + 2m 39s Results for commit 72efbd5. ± Comparison against base commit 10328bb. This pull request removes 2 and adds 7 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - assuming someone else will grant explicit approval for these changes.
packages/service/ni_measurement_plugin_sdk_service/measurement/service.py
Outdated
Show resolved
Hide resolved
packages/service/ni_measurement_plugin_sdk_service/measurement/service.py
Show resolved
Hide resolved
…if there is no .serviceconfig version (#911) * Update version checking to warn that version is deprecated and to ensure that there is a version in the .serviceconfig file * Fix lint error * Update error message to mention version field in .serviceconfig * Fix assert * Fix lint errors * Remove RuntimeError * Use empty string * Fix test to not expect RuntimeError * Fix formatting (cherry picked from commit 113b166)
def test___service_config___create_measurement_service_with_version___service_config_has_no_version( | ||
test_assets_directory: pathlib.Path, | ||
): | ||
measurement_service = MeasurementService( | ||
service_config_path=test_assets_directory / "example.NoVersion.serviceconfig", | ||
version="2.0.1", | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are generating warnings:
============================== warnings summary ===============================
tests/unit/test_service.py::test___service_config___create_measurement_service_with_version___version_differs_from_service_config
tests/unit/test_service.py::test___service_config___create_measurement_service_with_version___service_config_has_no_version
tests/unit/test_service.py::test___service_config___create_measurement_service_with_version___version_is_used[example.serviceconfig-1.0.1]
tests/unit/test_service.py::test___service_config___create_measurement_service_with_version___version_is_used[example.v1.serviceconfig-1.0.1]
D:\a\measurement-plugin-python\measurement-plugin-python\packages\service\ni_measurement_plugin_sdk_service\measurement\service.py:222: DeprecationWarning: The 'version' constructor parameter is deprecated. Specify the version using the 'version' field in the .serviceconfig file instead.
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
- generated xml file: D:\a\measurement-plugin-python\measurement-plugin-python\packages\service\test_results\nims-windows-latest-py3.9-all-extras.xml -
Fixed in #942
…if there is no .serviceconfig version (#911) * Update version checking to warn that version is deprecated and to ensure that there is a version in the .serviceconfig file * Fix lint error * Update error message to mention version field in .serviceconfig * Fix assert * Fix lint errors * Remove RuntimeError * Use empty string * Fix test to not expect RuntimeError * Fix formatting (cherry picked from commit 113b166)
…ion is deprecated and error if there is no .serviceconfig version (#935) Update version checking to warn that version is deprecated and error if there is no .serviceconfig version (#911) * Update version checking to warn that version is deprecated and to ensure that there is a version in the .serviceconfig file * Fix lint error * Update error message to mention version field in .serviceconfig * Fix assert * Fix lint errors * Remove RuntimeError * Use empty string * Fix test to not expect RuntimeError * Fix formatting (cherry picked from commit 113b166) Co-authored-by: Joel Dixon <[email protected]>
What does this Pull Request accomplish?
Fixes #908
This gives a warning if the 'version' parameter of
MeasurementService
is used. It also errors if there is a 'version' parameter, but no 'version' in the .serviceconfig file. The rule is if you pass a 'version' parameter, you must have the same 'version' in the .serviceconfig file.Why should this Pull Request be merged?
Gives clearer guidance on the latest state of the version parameters.
What testing has been done?
Existing tests plus added one test to verify a RuntimeError in the case where there is a 'version' parameter passed but no version in the .serviceconfig file.