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

key-duplicates: Fix failing test for missing space after colon #479

Merged
merged 1 commit into from Jul 8, 2022

Conversation

adrienverge
Copy link
Owner

@adrienverge adrienverge commented Jul 8, 2022

Commit c268a82 "key-duplicates: Don't crash on redundant closing
brackets or braces" fixed a problem but introduced another one: it
crashes on systems with (I guess) an old version of PyYAML. This is
probably linked to the "Allow colon in a plain scalar in a flow context"
issue on PyYAML [1].
For example, this problem happens on CentOS 8:

FAIL: test_disabled (tests.rules.test_key_duplicates.KeyDuplicatesTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "…/tests/rules/test_key_duplicates.py", line 90, in test_disabled
    '{a:1, b:2}}\n', conf, problem=(2, 11, 'syntax'))
  File "…/tests/common.py", line 54, in check
    self.assertEqual(real_problems, expected_problems)
AssertionError: Lists differ: …
- [2:3: syntax error: found unexpected ':' (syntax)]
+ [2:11: <no description>]

I propose to simply fix the space following a colon problem, since
it's not related to what the original author @tamere-allo-peter tried to
fix.

[1]: yaml/pyyaml#45

@coveralls
Copy link

coveralls commented Jul 8, 2022

Coverage Status

Coverage remained the same at 99.169% when pulling 0e09430 on fix/key-duplicates into 8a364e2 on master.

Commit c268a82 "key-duplicates: Don't crash on redundant closing
brackets or braces" fixed a problem but introduced another one: it
crashes on systems with (I guess) an old version of PyYAML. This is
probably linked to the "Allow colon in a plain scalar in a flow context"
issue on PyYAML [1].
For example, this problem happens on CentOS 8:

    FAIL: test_disabled (tests.rules.test_key_duplicates.KeyDuplicatesTestCase)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "…/tests/rules/test_key_duplicates.py", line 90, in test_disabled
        '{a:1, b:2}}\n', conf, problem=(2, 11, 'syntax'))
      File "…/tests/common.py", line 54, in check
        self.assertEqual(real_problems, expected_problems)
    AssertionError: Lists differ: …
    - [2:3: syntax error: found unexpected ':' (syntax)]
    + [2:11: <no description>]

I propose to simply fix the *space following a colon* problem, since
it's not related to what the original author @tamere-allo-peter tried to
fix.

[1]: yaml/pyyaml#45
@adrienverge adrienverge merged commit 8d543a4 into master Jul 8, 2022
@adrienverge adrienverge deleted the fix/key-duplicates branch July 8, 2022 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants