These are chat archives for coala/coala-bears

27th
Jan 2018
Manan Kalra
@manankalra
Jan 27 2018 09:40
How to append a Setting i.e. a parameter for the create_arguments() while testing a bear using verify_local_bear()?
saksham189
@saksham189
Jan 27 2018 10:36
you can just add a dictionary with all the settings and pass it to the function
Refer to ESLintBearTest @manankalra
Manan Kalra
@manankalra
Jan 27 2018 10:41
what happens is - it takes the contents of the file passed as params
I'm passing the file location as a string
Manan Kalra
@manankalra
Jan 27 2018 10:47
@anctartica got it, thanks ;)
Kriti Rohilla
@kriti21
Jan 27 2018 17:11
@ishanSrt Would you please look at coala/coala-bears#2253 one more time? The previous assertion error is not there now but pytestshows some problem in Jinja2BearCustomControlSpacingTest.test_valid_files
Here is the screenshot if it helps
self = <coalib.testing.LocalBearTestHelper.verify_local_bear.<locals>.LocalBearTest testMethod=test_valid_files>

    def test_valid_files(self):
        self.assertIsInstance(valid_files, (list, tuple))
        for file in valid_files:
            self.check_validity(self.uut,
                                file.splitlines(keepends=True),
                                filename,
                                valid=True,
                                force_linebreaks=force_linebreaks,
                                create_tempfile=create_tempfile,
>                               tempfile_kwargs=tempfile_kwargs)

../coala-venv/lib/python3.5/site-packages/coalib/testing/LocalBearTestHelper.py:333: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../coala-venv/lib/python3.5/site-packages/coalib/testing/LocalBearTestHelper.py:127: in check_validity
    settings=settings,
../coala-venv/lib/python3.5/site-packages/coalib/testing/LocalBearTestHelper.py:234: in check_results
    self.assertEqual(bear_output, results, msg=msg)
E   AssertionError: Lists differ: [<Result object(id=0xfba1f89b5740493298297[914 chars]cf8>] != []
E   
E   First list contains 2 additional elements.
E   First extra element 0:
E   <Result object(id=0xfba1f89b5740493298297188d8ba54fc, origin='Jinja2Bear', affected_code=(<SourceRange object(start=<SourcePosition object(file='/tmp/tmpxl2ogv3b', line=1, column=5) at 0x7f9aa28a59e8>, end=<SourcePosition object(file='/tmp/tmpxl2ogv3b', line=1, column=21) at 0x7f9aa28a56d8>) at 0x7f9aa28a50f0>,), severity=NORMAL, confidence=100, message='Statement blocks should be spaced with `1` spaces on each side.', aspect=NoneType, applied_actions={}) at 0x7f9aa28a5278>
E   
E   Diff is 972 characters long. Set self.maxDiff to None to see it. : The local bear 'Jinja2Bear' yields a result although it shouldn't.
saksham189
@saksham189
Jan 27 2018 17:14
you should look at the message of the result object
it says "Statement blocks should be spaced with 1 spaces on each side."
Kriti Rohilla
@kriti21
Jan 27 2018 17:16
Yes but this is fine. This should be displayed like it does when bear is applied on some file.
Why is it causing error then ?
saksham189
@saksham189
Jan 27 2018 17:17
valid files should not yield a result
but it is yielding a result object
for the test you mentioned
is it possible that your statement regex is matching the control blocks? @kriti21
Kriti Rohilla
@kriti21
Jan 27 2018 17:20
Yes it is checking statement blocks and for invalid ones, it displays the above message
Okay got it. Thanks @anctartica
saksham189
@saksham189
Jan 27 2018 17:27
yes it is actually matching the control blocks as well @kriti21. I think you need to fix the regex. :+1:
Kriti Rohilla
@kriti21
Jan 27 2018 17:28
Yeah I got that. Thanks a lot :)