Skip to content

Commit

Permalink
Fix a test that started failing after rebase (#3173)
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong authored Apr 26, 2024
1 parent de442c3 commit 00e7522
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/cfnlint/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import hashlib
import uuid
from pathlib import Path
from typing import TYPE_CHECKING

if TYPE_CHECKING:
Expand Down Expand Up @@ -56,7 +57,8 @@ def __init__(

def __repr__(self):
"""Represent"""
file_str = self.filename + ":" if self.filename else ""
# use the Posix path to keep things consistent across platforms
file_str = Path(self.filename).as_posix() + ":" if self.filename else ""
return f"[{self.rule}] ({self.message}) matched {file_str}{self.linenumber}"

def __eq__(self, item):
Expand Down
31 changes: 22 additions & 9 deletions test/integration/test_good_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
SPDX-License-Identifier: MIT-0
"""

from pathlib import Path
from test.integration import BaseCliTestCase

from cfnlint import ConfigMixIn
Expand Down Expand Up @@ -39,8 +40,10 @@ class TestQuickStartTemplates(BaseCliTestCase):
),
"results": [
{
"Filename": (
"test/fixtures/templates/bad/transform_serverless_template.yaml"
"Filename": str(
Path(
"test/fixtures/templates/bad/transform_serverless_template.yaml"
)
),
"Id": "74181426-e865-10eb-96fd-908dfd30a358",
"Location": {
Expand Down Expand Up @@ -70,8 +73,10 @@ class TestQuickStartTemplates(BaseCliTestCase):
),
},
{
"Filename": (
"test/fixtures/templates/bad/transform_serverless_template.yaml"
"Filename": str(
Path(
"test/fixtures/templates/bad/transform_serverless_template.yaml"
)
),
"Id": "fd751fa3-7d1f-e194-7108-eb08352814c8",
"Location": {
Expand Down Expand Up @@ -100,8 +105,10 @@ class TestQuickStartTemplates(BaseCliTestCase):
),
},
{
"Filename": (
"test/fixtures/templates/bad/transform_serverless_template.yaml"
"Filename": str(
Path(
"test/fixtures/templates/bad/transform_serverless_template.yaml"
)
),
"Id": "9e05773a-b0d0-f157-2955-596d9bd54749",
"Location": {
Expand Down Expand Up @@ -152,7 +159,11 @@ class TestQuickStartTemplates(BaseCliTestCase):
"filename": "test/fixtures/templates/bad/resources_cognito_userpool_tag_is_list.yaml",
"results": [
{
"Filename": "test/fixtures/templates/bad/resources_cognito_userpool_tag_is_list.yaml",
"Filename": str(
Path(
"test/fixtures/templates/bad/resources_cognito_userpool_tag_is_list.yaml"
)
),
"Id": "3732b0a0-6d44-72af-860a-88e5f8ca790c",
"Level": "Error",
"Location": {
Expand Down Expand Up @@ -201,8 +212,10 @@ class TestQuickStartTemplates(BaseCliTestCase):
),
"results": [
{
"Filename": (
"test/fixtures/templates/good/transform_serverless_globals.yaml"
"Filename": str(
Path(
"test/fixtures/templates/good/transform_serverless_globals.yaml"
)
),
"Id": "fc9f2534-f4f8-092b-52d6-dafd2d429b67",
"Level": "Error",
Expand Down

0 comments on commit 00e7522

Please sign in to comment.