Fix in logic for handling exclusive namespace testing. Fixes #6048.