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

Python 3.7.0b4 test failures #61

Closed
hroncok opened this issue May 29, 2018 · 5 comments
Closed

Python 3.7.0b4 test failures #61

hroncok opened this issue May 29, 2018 · 5 comments

Comments

@hroncok
Copy link
Contributor

hroncok commented May 29, 2018

$ tox -e py37
...
============================= test session starts ==============================
platform linux -- Python 3.7.0b4, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
rootdir: .../mccabe, inifile:
collected 14 items                                                             

test_mccabe.py ..F...........                                            [100%]

=================================== FAILURES ===================================
____________________ McCabeTestCase.test_expr_as_statement _____________________

self = <test_mccabe.McCabeTestCase testMethod=test_expr_as_statement>

    def test_expr_as_statement(self):
        complexity = get_complexity_number(expr_as_statement, self.strio)
>       self.assertEqual(complexity, 1)
E       AssertionError: 2 != 1

test_mccabe.py:192: AssertionError
===================== 1 failed, 13 passed in 0.06 seconds ======================
ERROR: InvocationError: '.../mccabe/.tox/py37/bin/python setup.py test -q'
___________________________________ summary ____________________________________
ERROR:   py37: commands failed
  • pytest 3.6.0
  • six 1.11.0
  • py 1.5.3
  • pluggy 0.6.0
  • more_itertools 4.2.0
  • attrs 18.1.0
  • atomicwrites 1.1.5
@ncoghlan
Copy link

Checking the test, I think this test failure is likely to go away in 3.7.0b5 - there was a planned change to the way docstrings were handled which we ended up reverting after we realised that it was affecting more than just functions and classes.

That said, switching to a non-docstring expression-as-statement in the example would make this test resilient against any future changes in this area (e.g. making it a numeric literal, like 0x_CAFE_F00D).

@hroncok hroncok changed the title Python 3.7 test failures Python 3.7.0b4 test failures May 30, 2018
@sigmavirus24
Copy link
Member

@hroncok @ncoghlan I'd accept a PR that changes the test to using a literal like that for future-proofing purposes. (Although I'm certain whoever wrote this test thought that docstrings were future-proof too 😄 )

@hroncok
Copy link
Contributor Author

hroncok commented May 30, 2018

On it.

@hroncok
Copy link
Contributor Author

hroncok commented May 30, 2018

I've just spent a minute trying to figure out why 0x_CAFE_F00D doesn't work on Python 3.5 🙄

@ncoghlan
Copy link

D'oh! And I almost left the underscores out of the suggestion, too :)

hroncok added a commit to hroncok/mccabe that referenced this issue May 30, 2018
This caused an increased complexity number on 3.7.0b4 when
docstring was used in the expr_as_statement test.

Solution:

While this change in Python will most likely get reverted
according to [1], we decided to use a non-docstring expression
in the test to avoid this problem in the future if docstring
handling ever gets changed again.

Fixes PyCQA#61

[1] PyCQA#61 (comment)
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

No branches or pull requests

3 participants