Allow tests to be properly skipped if `mock` is not installed.
Fix test expected output plus an additional one for pip git install.
Merge pull request #6899 from s0undt3ch/hotfix/mock-not-available

Allow tests to be properly skipped if `mock` is not installed