Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing Error #733

Open
KenStorey opened this issue Nov 11, 2021 · 1 comment
Open

Parsing Error #733

KenStorey opened this issue Nov 11, 2021 · 1 comment
Assignees

Comments

@KenStorey
Copy link

platform linux -- Python 3.9.0, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/local/bin/python cachedir: .pytest_cache metadata: {'Python': '3.9.0', 'Platform': 'Linux-4.19.128-microsoft-standard-x86_64-with', 'Packages': {'pytest': '6.2.5', 'py': '1.11.0', 'pluggy': '1.0.0'}, 'Plugins': {'metadata': '1.11.0', 'tavern': '1.17.0', 'html': '3.1.1'}} rootdir: /tavern_tests plugins: metadata-1.11.0, tavern-1.17.0, html-3.1.1

I have the following stage
`

 mqtt_publish:
  topic: "{hmi_display_field_topic}"
  json:
    application: "{test_app}"
    application_ref: 5000
    field_list:
      - "registered-identity"
      - "func-alias"
      - "status-1"
      - "action"
      - "explanation-1"
      - "status-2"
      - "status-3"
      - "status-4"
    field_values:
      - "Registered Identity"
      - "Alias"
      - "Status 1"
      - "Action"
      - "Explanation 1"
      - "S#2"
      - "S#3"
      - "Status#4"
    field_justification_values: [0, 0, 0, 0, 0, 0, 0, 0]
    field_flashing_values: [false, false, false, false, false, false, false, false]
    field_highlighted_values: [false, false, false, false, false, false, false, false]

`
Which validates correctly however, on execution, Tavern reports

FAILED tavern_tests/test_tdcp_display_field.tavern.yaml::Multiple fields - ValueError: expected '}' before end of string

I have attached a full stack trace.

tavern_stack_trace.txt

@michaelboulton
Copy link
Member

It looks like this is because the thing it's trying to format:

to_format = '{Explanation 1      '

Has an opening curly brace but no closing curly brace which is making the Formatter.parse method throw an error.

As this isn't controlled by Tavern, a good solution might be to log a warning if this happens and just not format the given string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants