Accepting request 878753 from home:bnavigator:python39
- Add jedi-py39-pytest.patch to support Python 3.9 OBS-URL: https://build.opensuse.org/request/show/878753 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jedi?expand=0&rev=86
This commit is contained in:
parent
ddfe9fe565
commit
817604cf29
60
jedi-py39-pytest.patch
Normal file
60
jedi-py39-pytest.patch
Normal file
@ -0,0 +1,60 @@
|
||||
From 85ec94cf6518e3446c5b19048c046a784fed4130 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Halter <davidhalter88@gmail.com>
|
||||
Date: Sat, 26 Dec 2020 03:32:17 +0100
|
||||
Subject: [PATCH] Fix pytest issues, fixes #1699
|
||||
|
||||
---
|
||||
jedi/plugins/pytest.py | 24 +++++++++++++++++++++---
|
||||
1 file changed, 21 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/jedi/plugins/pytest.py b/jedi/plugins/pytest.py
|
||||
index cec237338..d0dfba018 100644
|
||||
--- a/jedi/plugins/pytest.py
|
||||
+++ b/jedi/plugins/pytest.py
|
||||
@@ -5,6 +5,7 @@
|
||||
from jedi.inference.imports import load_module_from_path
|
||||
from jedi.inference.filters import ParserTreeFilter
|
||||
from jedi.inference.base_value import NO_VALUES, ValueSet
|
||||
+from jedi.inference.helpers import infer_call_of_leaf
|
||||
|
||||
_PYTEST_FIXTURE_MODULES = [
|
||||
('_pytest', 'monkeypatch'),
|
||||
@@ -147,18 +148,35 @@ class FixtureFilter(ParserTreeFilter):
|
||||
def _filter(self, names):
|
||||
for name in super()._filter(names):
|
||||
funcdef = name.parent
|
||||
+ # Class fixtures are not supported
|
||||
if funcdef.type == 'funcdef':
|
||||
- # Class fixtures are not supported
|
||||
decorated = funcdef.parent
|
||||
if decorated.type == 'decorated' and self._is_fixture(decorated):
|
||||
yield name
|
||||
|
||||
def _is_fixture(self, decorated):
|
||||
- for decorator in decorated.children:
|
||||
+ decorators = decorated.children[0]
|
||||
+ if decorators.type == 'decorators':
|
||||
+ decorators = decorators.children
|
||||
+ else:
|
||||
+ decorators = [decorators]
|
||||
+ for decorator in decorators:
|
||||
dotted_name = decorator.children[1]
|
||||
# A heuristic, this makes it faster.
|
||||
if 'fixture' in dotted_name.get_code():
|
||||
- for value in self.parent_context.infer_node(dotted_name):
|
||||
+ if dotted_name.type == 'atom_expr':
|
||||
+ # Since Python3.9 a decorator does not have dotted names
|
||||
+ # anymore.
|
||||
+ last_trailer = dotted_name.children[-1]
|
||||
+ last_leaf = last_trailer.get_last_leaf()
|
||||
+ if last_leaf == ')':
|
||||
+ values = infer_call_of_leaf(
|
||||
+ self.parent_context, last_leaf, cut_own_trailer=True)
|
||||
+ else:
|
||||
+ values = self.parent_context.infer_node(dotted_name)
|
||||
+ else:
|
||||
+ values = self.parent_context.infer_node(dotted_name)
|
||||
+ for value in values:
|
||||
if value.name.get_qualified_names(include_module_names=True) \
|
||||
== ('_pytest', 'fixtures', 'fixture'):
|
||||
return True
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Mar 13 13:33:44 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Add jedi-py39-pytest.patch to support Python 3.9
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 25 19:03:26 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-jedi
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -27,6 +27,8 @@ Group: Development/Languages/Python
|
||||
URL: https://github.com/davidhalter/jedi
|
||||
Source0: https://files.pythonhosted.org/packages/source/j/jedi/jedi-%{version}.tar.gz
|
||||
Source1: %{name}-rpmlintrc
|
||||
# PATCH-FIX-UPSTREAM Support pytest completion for Python 3.9 -- gh#davidhalter/jedi#1699
|
||||
Patch0: https://github.com/davidhalter/jedi/commit/85ec94cf.patch#/jedi-py39-pytest.patch
|
||||
BuildRequires: %{python_module parso >= 0.8.0}
|
||||
# need pytest 5 https://github.com/davidhalter/jedi/issues/1660
|
||||
BuildRequires: %{python_module pytest < 6.0.0}
|
||||
@ -52,7 +54,7 @@ Jedi uses an API to connect with IDEs. There is a reference
|
||||
implementation as a VIM plugin which uses Jedi's autocompletion.
|
||||
|
||||
%prep
|
||||
%setup -q -n jedi-%{version}
|
||||
%autosetup -p1 -n jedi-%{version}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
Loading…
Reference in New Issue
Block a user