It sounds like Apple enforced the entitlements usage in iOS 16 CloudKit.
You need to run your tests in Xcode : generate a Xcode project before running your SPM tests or use the target which uses your package (I guess at some point your package is added to a regular iOS/macOS target).
https://forums.swift.org/t/how-can-test-targets-be-run-with-entitlement/47482/2