Mock check_winpe in test_driver_wim and correct its call expectations. - #803
Open
MohammedAlkindi wants to merge 1 commit into
Open
Mock check_winpe in test_driver_wim and correct its call expectations.#803MohammedAlkindi wants to merge 1 commit into
MohammedAlkindi wants to merge 1 commit into
Conversation
The test read the real registry, so its branch depended on the host. Its expectations also mixed WINPE_DISM for mount and unmount with SYS_PNPUTIL for add-driver, which _ProcessWim cannot emit in one run because both derive from the same lru_cache-wrapped check_winpe result. Mocks the probe to False and matches the mount and unmount constants to it. test_driver_wim_winpe already covers the True branch the same way.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_driver_wimdoes not mockwinpe.check_winpe(), so it reads the host registry and its outcome depends on the machine running it. On a non-WinPE host it fails.The expected call list is also internally inconsistent: it pairs
WINPE_DISMfor mount and unmount withSYS_PNPUTILfor add-driver._ProcessWimderives both from the samelru_cache-wrappedcheck_winpe(), so a run emits all-WinPE or all-SYS paths, never a mix.This adds the mock returning
Falseand corrects the two mount and unmount constants.test_driver_wim_winpealready covers theTruebranch with the same convention, so the two tests now cover one branch each.python_tests.ymlrunsubuntu-latestonly, whereos.path.join(ROOT, os.sep, ...)inconstants.pydiscards the drive letter andWINPE_DISMequalsSYS_DISM, which hides the inconsistency. That collapse is #796 and is not touched here.Windows 11, Python 3.13.13,
python -m glazier.lib.actions.drivers_test: beforeRan 10 tests/FAILED (failures=1), afterRan 10 tests/OK. Inverting the mock toTruemakes it fail again, so it still discriminates on the branch. No other module in the suite changes status.