Skip to content

Unhandled Exception with cfn test - Permission error with pytest ini file #876

Closed
@tjbrockmeyer

Description

@tjbrockmeyer

OS: Windows 10 Pro 64-bit

I am attempting to use cfn test after developing a resource type, and I am receiving a permission error related to a generated pytest ini file.

This is the output of running cfn test:

Resource schema is valid.
=== Unhandled exception ===
Please report this issue to the team.
Issue tracker: github.com/aws-cloudformation/cloudformation-cli/issues
Please include the log file 'rpdk.log'

Here is the full log output:

[2022-04-11T00:16:21Z] DEBUG    - Logging set up successfully
[2022-04-11T00:16:21Z] DEBUG    - Running test: Namespace(version=False, subparser_name='test', command=<function test at 0x00000241BA2D7280>, verbose=0, endpoint='http://127.0.0.1:3001', function_name='TypeFunction', region='us-east-1', role_arn=None, cloudformation_endpoint_url=None, enforce_timeout='30', log_group_name=None, log_role_arn=None, passed_to_pytest=[], docker_image=None)
[2022-04-11T00:16:21Z] DEBUG    - Root directory: C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring
[2022-04-11T00:16:21Z] DEBUG    - Loading project file 'C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring\.rpdk-config'
[2022-04-11T00:16:21Z] INFO     - Validating your resource specification...
[2022-04-11T00:16:21Z] DEBUG    - Rewriting refs in '<BASE>' (file:///C:/Coding/code/web/infra/aws/custom-resources/tjb-ssm-securestring/tjb-ssm-securestring.json)
[2022-04-11T00:16:21Z] WARNING  - Resource schema is valid.
[2022-04-11T00:16:21Z] INFO     - Validating your resource schema...
[2022-04-11T00:16:21Z] DEBUG    - Override file 'C:\Coding\code\web\infra\aws\custom-resources\tjb-ssm-securestring\overrides.json' not found. No overrides will be applied
[2022-04-11T00:16:22Z] DEBUG    - Setup plugin for RESOURCE type
[2022-04-11T00:16:22Z] DEBUG    - temporary pytest.ini path: C:\Users\Tyler\AppData\Local\Temp\pytest_mn_hg_yk.ini
[2022-04-11T00:16:22Z] DEBUG    - Unhandled exception
Traceback (most recent call last):
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\cli.py", line 100, in main
    args.command(args)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\test.py", line 384, in test
    invoke_test(args, project, overrides, None)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\test.py", line 390, in invoke_test
    with temporary_ini_file() as path:
  File "c:\coding\frameworks\python\python3.9.1\lib\contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\test.py", line 87, in temporary_ini_file
    copy_resource(__name__, "data/pytest-contract.ini", path)
  File "c:\coding\frameworks\python\python3.9.1\lib\site-packages\rpdk\core\data_loaders.py", line 54, in copy_resource
    ) as fsrc, out_path.open("wb") as fdst:
  File "c:\coding\frameworks\python\python3.9.1\lib\pathlib.py", line 1241, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "c:\coding\frameworks\python\python3.9.1\lib\pathlib.py", line 1109, in _opener
    return self._accessor.open(self, flags, mode)
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Tyler\\AppData\\Local\\Temp\\pytest_mn_hg_yk.ini'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions