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

[Bug]: Failing test on python 3.12: TestCodeBlockChecker.test_check_python_returns_error_on_syntax_warning #57

Closed
3 tasks done
sanjayankur31 opened this issue Aug 29, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@sanjayankur31
Copy link

sanjayankur31 commented Aug 29, 2023

To Dos

  • I tested with the latest released version.

  • I have checked the issues and think that this is not a duplicate.

  • I added a very descriptive title to this issue.

Example Code (python)

While building the package on Fedora, we're seeing this one test fail.

Relevant log output

+ /usr/bin/pytest
============================= test session starts ==============================
platform linux -- Python 3.12.0rc1, pytest-7.4.0, pluggy-1.2.0
rootdir: /builddir/build/BUILD/rstcheck_core-1.0.3
configfile: pyproject.toml
plugins: mock-3.11.1
collected 458 items

tests/test__docutils.py ....s.....                                       [  2%]
tests/test__extras.py .ss.s.s.                                           [  3%]
tests/test__sphinx.py s.s.ssssssss                                       [  6%]
tests/test_checker.py ..............ss.s..sss...ssssss...sss...........s [ 17%]
..s.sF.............ss..ss..ss..ss.ss...                                  [ 25%]
tests/test_config.py ................................................... [ 37%]
...............................................................sssssssss [ 52%]
sssssssssssssss.....sss.....ssss.sss...................                  [ 64%]
tests/test_inline_config.py ....................                         [ 69%]
tests/test_runner.py ..ssssss...................................         [ 78%]
tests/test_types.py ..                                                   [ 79%]
tests/integration_tests/test_file_checker.py ......................s..s. [ 84%]
s.........s..s.s.                                                        [ 88%]
tests/integration_tests/test_runner.py ..........................s..s.s. [ 95%]
............s..s.s.                                                      [100%]

=================================== FAILURES ===================================
____ TestCodeBlockChecker.test_check_python_returns_error_on_syntax_warning ____

        @staticmethod
        @pytest.mark.skipif(sys.version_info < (3, 8), reason="Requires python3.8 or higher")
        def test_check_python_returns_error_on_syntax_warning() -> None:
            """Test ``check_python`` returns error on SyntaxWarning.

            With python 3.8 a SyntaxWarning is logged for '"is" with literals'.

            Context: https://github.com/rstcheck/rstcheck/issues/122
            """
            source = """
    if mystring is "ok":
        ...
    """
            cb_checker = checker.CodeBlockChecker("<string>")

            result = list(cb_checker.check_python(source))

            assert len(result) == 1
>           assert '"is" with a literal' in result[0]["message"]
E           assert '"is" with a literal' in '"is" with \'str\' literal. Did you mean "=="?'

cb_checker = <rstcheck_core.checker.CodeBlockChecker object at 0x7fda444f5400>
result     = [{'line_number': 2, 'message': '"is" with \'str\' literal. Did you mean "=="?', 'source_origin': '<string>'}]
source     = '\nif mystring is "ok":\n    ...\n'

tests/test_checker.py:735: AssertionError
   

Description

While building the package on Fedora, we're seeing this one test fail.

Downstream report: https://bugzilla.redhat.com/show_bug.cgi?id=2226320

Operating System

Linux

Operating System Details

No response

Python Version

3.12.0rc1

rstcheck Version

1.0.3

Additional Context

No response

@sanjayankur31 sanjayankur31 added bug Something isn't working triage labels Aug 29, 2023
@Cielquan
Copy link
Contributor

Cielquan commented Sep 3, 2023

I guess a new test case needs to be added for the new py3.12 error message.

@Cielquan Cielquan removed the triage label Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants