Improve namespace handling in tests