Make unit tests for oneCore pass under the versions of Windows where oneCore is not supported#12702
Conversation
|
Are not the u and a in Language the wrong way around in the code?
Brian
***@***.***
Sent via blueyonder.
Please address personal E-mail to:-
***@***.***, putting 'Brian Gaff'
in the display name field.
Newsgroup monitored: alt.comp.blind-users
----- Original Message -----
From: "Łukasz Golonka" ***@***.***>
To: "nvaccess/nvda" ***@***.***>
Cc: "Subscribed" ***@***.***>
Sent: Friday, July 30, 2021 5:36 PM
Subject: [nvaccess/nvda] Make unit tests for oneCore pass under the versions
of Windows where oneCore is not supported (#12702)
… ### Link to issue number:
Fixes unit tests introduced in #12647
### Summary of the issue:
Some unit tests introduced as part of #12647 were failing under versions
of Windows where oneCore was unsupported. The output was as follows:
```
FAIL: Ensures that if oneCore doesn't support the current language,
setSynth("auto") falls back to the
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\my_repos\nvda\tests\unit\test_synthDriverHandler.py",
line 113, in
test_setSynth_auto_fallback_ifOneCoreDoesntSupportDefaultLangauge
self.assertEqual(synthDriverHandler.getSynth().name,
FAKE_DEFAULT_SYNTH_NAME)
AssertionError: 'espeak' != 'defaultSynth'
- espeak
+ defaultSynth
======================================================================
FAIL: Ensures that if oneCore supports the current language,
setSynth("auto") uses "oneCore".
----------------------------------------------------------------------
Traceback (most recent call last):
File "D:\my_repos\nvda\tests\unit\test_synthDriverHandler.py",
line 104, in test_setSynth_auto_usesOneCore_ifSupportsDefaultLangauge
self.assertEqual(synthDriverHandler.getSynth().name,
"oneCore")
AssertionError: 'espeak' != 'oneCore'
- espeak
+ oneCore
```
### Description of how this pull request fixes the issue:
Now these tests behave differently depending on oneCore being supported or
not.
### Testing strategy:
Unit tests passes locally whereas previously they didn't. I'll
inspect log on AppVeyor to ensure they still pass on a version of Windows
where oneCore is supported.
### Known issues with pull request:
None known.
### Change log entries:
None needed
### Code Review Checklist:
- [x] Pull Request description is up to date.
- [x] Unit tests.
- [x] System (end to end) tests.
- [x] Manual testing.
- [x] User Documentation.
- [x] Change log entry.
- [x] Context sensitive help for GUI changes.
- [x] UX of all users considered:
- Speech
- Braille
- Low Vision
- Different web browsers
You can view, comment on, or merge this pull request online at:
#12702
-- Commit Summary --
* Make unit tests for oneCore pass under the versions of Windows where
oneCore is not supported
-- File Changes --
M tests/unit/test_synthDriverHandler.py (24)
-- Patch Links --
https://github.com/nvaccess/nvda/pull/12702.patch
https://github.com/nvaccess/nvda/pull/12702.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#12702
|
This has been fixed as part of this PR. |
|
I think performing logic within the test defeats the purpose of these tests. Generally you should avoid conditional logic within unit testing. I think it might be better to just add these wrappers to the existing oneCore tests @unittest.case.skipIf(winVersion.getWinVer() < winVersion.WIN10, "oneCore unsupported on this OS") |
159b3b9 to
de9cd87
Compare
I agree conditional logic is an anti-pattern for unit tests however currently these test rely on
I've done mostly as you suggested however rather than testing for a version of Windows in use I'm checking for oneCore being supported which guarantees that if we would need to ever drop support of it and / or it would become broken on a particular version of Windows the check would not need to be modifiied in more than one place. |
seanbudd
left a comment
There was a problem hiding this comment.
Thanks @lukaszgo1, looks good to me.
Link to issue number:
Fixes unit tests introduced in #12647
Summary of the issue:
Some unit tests introduced as part of #12647 were failing under versions of Windows where oneCore was unsupported. The output was as follows:
Description of how this pull request fixes the issue:
Tests which require oneCore being supported are being skipped on versions of Windows on which oneCore is not supported.
Testing strategy:
Unit tests passes locally whereas previously they didn't. I'll inspect log on AppVeyor to ensure they still pass on a version of Windows where oneCore is supported.
Known issues with pull request:
None known.
Change log entries:
None needed
Code Review Checklist: