aws-cloudformation / cloudformation-cli

The CloudFormation Provider Development Toolkit allows you to author your own resource providers and modules that can be used by CloudFormation.
Apache License 2.0
316 stars 157 forks source link

cfn test throwing python exception #1065

Open Duddddd opened 2 months ago

Duddddd commented 2 months ago

When I run the command "cfn test -- -k contract_create_read" I get PermissionError (see full error log below). It does work when I use sudo "sudo cfn test -- -k contract_create_read" but I know it could work without ןא because it does in other environments. I have local lambda simulator running in my mac, I run it using sam command. The Full log is: Resource schema is valid. ======================================================================================== test session starts ======================================================================================== platform darwin -- Python 3.11.4, pytest-8.0.0, pluggy-1.4.0 -- /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 cachedir: .pytest_cache Test order randomisation NOT enabled. Enable with --random-order or --random-order-bucket= hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/Users/dfedida/IdeaProjects/fsxnontap_cfn/fsxn_ontap_resource_provider/netapp_cfn/resource_Exportpolicy/.hypothesis/examples')) rootdir: /private/var/folders/p8/wql98__s32jd3mfk_zn7svrc0000gp/T configfile: pytest_ay7csx_1.ini plugins: dependency-0.6.0, random-order-1.1.1, hypothesis-6.98.4, localserver-0.8.1 collected 0 items / 1 error

============================================================================================== ERRORS =============================================================================================== ERROR collecting test session /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pluggy/_hooks.py:501: in call return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pluggy/_manager.py:119: in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/python.py:210: in pytest_collect_directory if pkginit.is_file(): /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py:1267: in is_file return S_ISREG(self.stat().st_mode) /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/pathlib.py:1013: in stat return os.stat(self, follow_symlinks=follow_symlinks) E PermissionError: [Errno 13] Permission denied: '/Library/OSAnalytics/init.py' ====================================================================================== short test summary info ====================================================================================== ERROR ../../../../../../../private/var/folders/p8/wql98__s32jd3mfk_zn7svrc0000gp/T/::Library - PermissionError: [Errno 13] Permission denied: '/Library/OSAnalytics/init.py' ========================================================================================= 1 error in 0.08s ========================================================================================== ERROR: found no collectors for /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/rpdk/core/contract/suite