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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest 6 errors #1660

Closed
bnavigator opened this issue Aug 27, 2020 · 4 comments
Closed

Pytest 6 errors #1660

bnavigator opened this issue Aug 27, 2020 · 4 comments

Comments

@bnavigator
Copy link

bnavigator commented Aug 27, 2020

Yes, I know you specify 'pytest < 6.0.0' in setup.py.

Nevertheless, rolling distros tend to ignore these types of pinning Edit: We have a new python-pytest5 package in openSUSE, which I can use 馃帀

Here are the two tests failing with pytest 6:

[   19s] + pytest-3.8 --ignore=_build.python2 --ignore=_build.python3 --ignore=_build.pypy3 -v -k 'not (test_venv_and_pths or test_sqlite3_conversion or test_speed or test_init_extension_module)'
[   19s] ============================= test session starts ==============================
[   19s] platform linux -- Python 3.8.5, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 -- /usr/bin/python3
[   19s] cachedir: .pytest_cache
[   19s] rootdir: /home/abuild/rpmbuild/BUILD/jedi-0.17.2, configfile: pytest.ini, testpaths: jedi, test
[   21s] collecting ... collected 3719 items / 8 deselected / 3711 selected

...

[  144s] =================================== FAILURES ===================================
[  144s] _________________________ test_completion[pytest:130] __________________________
[  144s] 
[  144s] case = <IntegrationTestCase: /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/completion/pytest.py:130 '    monkeypatch.setatt'>
[  144s] monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f8764e70a90>
[  144s] environment = <Environment: 3.8.5 in /usr>, has_typing = True
[  144s] has_django = False
[  144s] 
[  144s]     def test_completion(case, monkeypatch, environment, has_typing, has_django):
[  144s]         skip_reason = case.get_skip_reason(environment)
[  144s]         if skip_reason is not None:
[  144s]             pytest.skip(skip_reason)
[  144s]     
[  144s]         if 'pep0484_typing' in case.path and sys.version_info[0] == 2:
[  144s]             pytest.skip('ditch python 2 finally')
[  144s]     
[  144s]         _CONTAINS_TYPING = ('pep0484_typing', 'pep0484_comments', 'pep0526_variables')
[  144s]         if not has_typing and any(x in case.path for x in _CONTAINS_TYPING):
[  144s]             pytest.skip('Needs the typing module installed to run this test.')
[  144s]         if (not has_django or environment.version_info.major == 2) and case.path.endswith('django.py'):
[  144s]             pytest.skip('Needs django to be installed to run this test.')
[  144s]         repo_root = helpers.root_dir
[  144s]         monkeypatch.chdir(os.path.join(repo_root, 'jedi'))
[  144s] >       case.run(assert_case_equal, environment)
[  144s] 
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/test_integration.py:54: 
[  144s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/run.py:206: in run
[  144s]     return testers[self.test_type](compare_cb, environment)
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/run.py:213: in run_completion
[  144s]     return compare_cb(self, comp_str, set(literal_eval(self.correct)))
[  144s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  144s] 
[  144s] case = <IntegrationTestCase: /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/completion/pytest.py:130 '    monkeypatch.setatt'>
[  144s] actual = set(), desired = {'setattr'}
[  144s] 
[  144s]     def assert_case_equal(case, actual, desired):
[  144s]         """
[  144s]         Assert ``actual == desired`` with formatted message.
[  144s]     
[  144s]         This is not needed for typical pytest use case, but as we need
[  144s]         ``--assert=plain`` (see ../pytest.ini) to workaround some issue
[  144s]         due to pytest magic, let's format the message by hand.
[  144s]         """
[  144s] >       assert actual == desired, """
[  144s]     Test %r failed.
[  144s]     actual  =
[  144s]     %s
[  144s]     desired =
[  144s]     %s
[  144s]     """ % (case, indent_block(str(actual)), indent_block(str(desired)))
[  144s] E       AssertionError: 
[  144s] E         Test <IntegrationTestCase: /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/completion/pytest.py:130 '    monkeypatch.setatt'> failed.
[  144s] E         actual  =
[  144s] E             set()
[  144s] E         desired =
[  144s] E             {'setattr'}
[  144s] E         
[  144s] E       assert set() == {'setattr'}
[  144s] E         Extra items in the right set:
[  144s] E         'setattr'
[  144s] E         Full diff:
[  144s] E         - {'setattr'}
[  144s] E         + set()
[  144s] 
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/test_integration.py:19: AssertionError
[  144s] _________________________ test_completion[pytest:163] __________________________
[  144s] 
[  144s] case = <IntegrationTestCase: /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/completion/pytest.py:163 '    caplog.set_le'>
[  144s] monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f8764fdd730>
[  144s] environment = <Environment: 3.8.5 in /usr>, has_typing = True
[  144s] has_django = False
[  144s] 
[  144s]     def test_completion(case, monkeypatch, environment, has_typing, has_django):
[  144s]         skip_reason = case.get_skip_reason(environment)
[  144s]         if skip_reason is not None:
[  144s]             pytest.skip(skip_reason)
[  144s]     
[  144s]         if 'pep0484_typing' in case.path and sys.version_info[0] == 2:
[  144s]             pytest.skip('ditch python 2 finally')
[  144s]     
[  144s]         _CONTAINS_TYPING = ('pep0484_typing', 'pep0484_comments', 'pep0526_variables')
[  144s]         if not has_typing and any(x in case.path for x in _CONTAINS_TYPING):
[  144s]             pytest.skip('Needs the typing module installed to run this test.')
[  144s]         if (not has_django or environment.version_info.major == 2) and case.path.endswith('django.py'):
[  144s]             pytest.skip('Needs django to be installed to run this test.')
[  144s]         repo_root = helpers.root_dir
[  144s]         monkeypatch.chdir(os.path.join(repo_root, 'jedi'))
[  144s] >       case.run(assert_case_equal, environment)
[  144s] 
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/test_integration.py:54: 
[  144s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/run.py:206: in run
[  144s]     return testers[self.test_type](compare_cb, environment)
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/run.py:213: in run_completion
[  144s]     return compare_cb(self, comp_str, set(literal_eval(self.correct)))
[  144s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  144s] 
[  144s] case = <IntegrationTestCase: /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/completion/pytest.py:163 '    caplog.set_le'>
[  144s] actual = set(), desired = {'set_level'}
[  144s] 
[  144s]     def assert_case_equal(case, actual, desired):
[  144s]         """
[  144s]         Assert ``actual == desired`` with formatted message.
[  144s]     
[  144s]         This is not needed for typical pytest use case, but as we need
[  144s]         ``--assert=plain`` (see ../pytest.ini) to workaround some issue
[  144s]         due to pytest magic, let's format the message by hand.
[  144s]         """
[  144s] >       assert actual == desired, """
[  144s]     Test %r failed.
[  144s]     actual  =
[  144s]     %s
[  144s]     desired =
[  144s]     %s
[  144s]     """ % (case, indent_block(str(actual)), indent_block(str(desired)))
[  144s] E       AssertionError: 
[  144s] E         Test <IntegrationTestCase: /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/completion/pytest.py:163 '    caplog.set_le'> failed.
[  144s] E         actual  =
[  144s] E             set()
[  144s] E         desired =
[  144s] E             {'set_level'}
[  144s] E         
[  144s] E       assert set() == {'set_level'}
[  144s] E         Extra items in the right set:
[  144s] E         'set_level'
[  144s] E         Full diff:
[  144s] E         - {'set_level'}
[  144s] E         + set()
[  144s] 
[  144s] /home/abuild/rpmbuild/BUILD/jedi-0.17.2/test/test_integration.py:19: AssertionError
[  144s] =========================== short test summary info ============================
[  144s] FAILED test/test_integration.py::test_completion[pytest:130] - AssertionError: 
[  144s] FAILED test/test_integration.py::test_completion[pytest:163] - AssertionError: 
[  144s] = 2 failed, 3588 passed, 116 skipped, 8 deselected, 5 xfailed in 124.25s (0:02:04) =
@davidhalter
Copy link
Owner

I guess these are fine until we upgrade to pytest 6.

@anthraxx
Copy link
Contributor

It would be awesome to see an upgrade to pytest 6, that would a bit aid distro packager integration without the need to carry around old pytest5 just for making jedi happy 馃惐 I would highly appreciate pytest 6 support 馃帀

@PeterJCLaw
Copy link
Collaborator

I had a very quick look at this. It doesn't reproduce on Python 3.6 (though does on Python 3.7 & 3.8; I've not tested 3.9). Notably also these are failures within tests which are testing Jedi's handling of pytest itself, rather than other test failures due to the platform being different.

@bnavigator
Copy link
Author

Yes, but the tests show that Jedi's completion of the Pytest monkeypatch and caplog fixtures fails although the expected attributes setattr and set_levelshould still be present in Pytest 6.

#! 15 ['def monkeypatch']
def test_p(monkeypatch):
#? ['setattr']
monkeypatch.setatt

https://docs.pytest.org/en/stable/reference.html#pytest.monkeypatch.MonkeyPatch.setattr

#! 48 ['def inheritance_fixture']
def test_inheritance_fixture(inheritance_fixture, caplog):
#? int()
inheritance_fixture
#? ['set_level']
caplog.set_le

https://docs.pytest.org/en/stable/reference.html#pytest.logging.LogCaptureFixture.set_level

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

4 participants