keychain error -34018 when running unit test on embedded framework on iOS10.3 or iOS11 Beta through XCode9

Originator:avner
Number:rdar://33623612 Date Originated:31.7.17
Status:Open Resolved:
Product:Xcode/iOS Product Version:
Classification:bug Reproducible:Always
 
Area:
Security Framework

Summary:
Basically I have a unit test which encounters some logic accessing the keychain. 
The unit test is testing an embedded framework.
Normally from my understanding the -34018 error is fixed by adding the "keychain sharing" entitlement, but since in my case the test is run without an application, there is no way to add this entitlement to the unit test target or to the framework target

Steps to Reproduce:
Create a framework with unit tests.

Create logic in the framework which accesses the keychain

Create a unit test which runs through the keychain logic (and have some sort of expectation from the keychain)

Expected Results:
Keychain should function normally

Observed Results:
You will get -34018 error on the keychain

Version:
10.3 or 11 (beta)

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!