[arch-commits] Commit in python-jedi/trunk (3 files)
Levente Polyak
anthraxx at archlinux.org
Sat Sep 21 00:20:11 UTC 2019
Date: Saturday, September 21, 2019 @ 00:20:10
Author: anthraxx
Revision: 511288
upgpkg: python-jedi 0.15.1-1 (using git for submodule dep + pytest fix)
- upstream release
- includes fix for pytest expecting str params to skip()
Added:
python-jedi/trunk/jedi-fix-pytest5.1.2.patch
Modified:
python-jedi/trunk/PKGBUILD
Deleted:
python-jedi/trunk/fix-environment-cache.patch
-----------------------------+
PKGBUILD | 77 +++++++++++-----
fix-environment-cache.patch | 21 ----
jedi-fix-pytest5.1.2.patch | 197 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 252 insertions(+), 43 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2019-09-20 23:22:18 UTC (rev 511287)
+++ PKGBUILD 2019-09-21 00:20:10 UTC (rev 511288)
@@ -1,4 +1,5 @@
# Maintainer: Jelle van der Waa <jelle at archlinux.org>
+# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Danilo Bargen <gezuru at gmail.com>
# Contributor: Simon Conseil <contact+aur at saimon dot org>
# Contributor: Jesus Alvarez
@@ -5,39 +6,71 @@
pkgbase=python-jedi
pkgname=('python2-jedi' 'python-jedi')
-pkgver=0.13.3
+_gitcommit=005f69390c4b1a3b864e7373cfcbdaf95e65411d
+pkgver=0.15.1
pkgrel=1
+pkgdesc="Awesome autocompletion for python"
+url="https://github.com/davidhalter/jedi"
arch=('any')
-url="https://github.com/davidhalter/jedi"
license=('MIT')
-makedepends=('python2-setuptools' 'python-setuptools')
+makedepends=('git' 'python2-setuptools' 'python-setuptools')
checkdepends=('python-pytest' 'python2-pytest' 'python-parso' 'python2-parso')
-source=("$pkgbase-$pkgver.tar.gz::https://github.com/davidhalter/jedi/archive/v$pkgver.tar.gz")
-sha256sums=('e82c4933b4c9717276fa6528b91d7c667463ac2773ccecd076e6b068c70a6e0e')
+source=("git+https://github.com/davidhalter/jedi#commit=${_gitcommit}"
+ git+https://github.com/davidhalter/typeshed
+ jedi-fix-pytest5.1.2.patch)
+sha256sums=('SKIP'
+ 'SKIP'
+ 'a02b616a3cdd178de894abb6212f6ce86432915dc5c12cd156da043433e6b153')
+pkgver() {
+ cd jedi
+ git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ (cd jedi
+ git submodule init
+ git config submodule."jedi/third_party/typeshed".url "${srcdir}/typeshed"
+ git submodule update --recursive
+ patch -Np1 < ../jedi-fix-pytest5.1.2.patch
+ )
+ cp -a jedi{,-py2}
+}
+
+build() {
+ (cd jedi
+ python setup.py build
+ )
+ (cd jedi-py2
+ python2 setup.py build
+ )
+}
+
check() {
- cd "$srcdir/jedi-${pkgver}"
- pytest test || warning 'Ignoring test_pyc failure'
+ (cd jedi
+ pytest test
+ )
+ (cd jedi-py2
+ pytest2 test
+ )
}
package_python-jedi() {
- pkgdesc="Awesome autocompletion for python"
- depends=('python' 'python-parso')
- conflicts=('python3-jedi-git')
- cd "$srcdir/jedi-${pkgver}"
- python3 setup.py install --root="$pkgdir/" --optimize=1
-
- install -D -m644 "$srcdir/jedi-${pkgver}/LICENSE.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ pkgdesc="Awesome autocompletion for python"
+ depends=('python' 'python-parso')
+ cd jedi
+ python setup.py install --root="$pkgdir" --optimize=1 --skip-build
+ install -Dm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname"
+ install -Dm 644 CHANGELOG.rst README.rst -t "$pkgdir/usr/share/doc/$pkgname"
}
package_python2-jedi() {
- pkgdesc="Awesome autocompletion for python2"
- depends=('python2' 'python2-parso')
- conflicts=('jedi-git' 'python2-jedi-git')
- cd "$srcdir/jedi-${pkgver}"
- python2 setup.py install --root="$pkgdir/" --optimize=1
-
- install -D -m644 "$srcdir/jedi-${pkgver}/LICENSE.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ pkgdesc="Awesome autocompletion for python2"
+ depends=('python2' 'python2-parso')
+ cd jedi-py2
+ python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
+ install -Dm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname"
+ install -Dm 644 CHANGELOG.rst README.rst -t "$pkgdir/usr/share/doc/$pkgname"
}
-# vim:set ts=2 sw=2 et
+# vim: ts=2 sw=2 et:
Deleted: fix-environment-cache.patch
===================================================================
--- fix-environment-cache.patch 2019-09-20 23:22:18 UTC (rev 511287)
+++ fix-environment-cache.patch 2019-09-21 00:20:10 UTC (rev 511288)
@@ -1,21 +0,0 @@
-diff -u -r jedi-0.13.1/jedi/api/environment.py jedi-0.13.1-fix/jedi/api/environment.py
---- jedi-0.13.1/jedi/api/environment.py 2018-10-02 17:07:35.000000000 +0000
-+++ jedi-0.13.1-fix/jedi/api/environment.py 2018-11-23 15:03:25.989461415 +0000
-@@ -190,15 +190,11 @@
-
-
- def get_cached_default_environment():
-- environment = _get_cached_default_environment()
-- if environment.path != os.environ.get('VIRTUAL_ENV'):
-- _get_cached_default_environment.clear_cache()
-- return _get_cached_default_environment()
-- return environment
-+ return _get_cached_default_environment(os.environ.get('VIRTUAL_ENV'))
-
-
- @time_cache(seconds=10 * 60) # 10 Minutes
--def _get_cached_default_environment():
-+def _get_cached_default_environment(_venv):
- return get_default_environment()
-
-
Added: jedi-fix-pytest5.1.2.patch
===================================================================
--- jedi-fix-pytest5.1.2.patch (rev 0)
+++ jedi-fix-pytest5.1.2.patch 2019-09-21 00:20:10 UTC (rev 511288)
@@ -0,0 +1,197 @@
+From f57a0b3469159954253b3be6d3147bc902095029 Mon Sep 17 00:00:00 2001
+From: Levente Polyak <levente at leventepolyak.net>
+Date: Fri, 20 Sep 2019 18:34:39 +0200
+Subject: [PATCH] fix static analysis test skips with latest pytest
+
+Latest pytest ensures pytest.skip is being called with a str parameter.
+However, test_static_analysis passed over the skip parameter which
+contains a tuple returned from skip_python_version leading to test
+regression.
+Unify the version skip reasons for both, static analysis and integration
+tests by using a shared BaseTestCase parent to avoid code duplication.
+Furthermore handle test_static_analysis skip_reason extraction
+orthogonal to test_completion.
+---
+ test/conftest.py | 42 +------------------------
+ test/run.py | 67 ++++++++++++++++++++++++++++++++++------
+ test/test_integration.py | 5 +--
+ 3 files changed, 61 insertions(+), 53 deletions(-)
+
+diff --git a/test/conftest.py b/test/conftest.py
+index 45bb48e0..389c7c98 100644
+--- a/test/conftest.py
++++ b/test/conftest.py
+@@ -10,7 +10,6 @@ from . import refactor
+
+ import jedi
+ from jedi.api.environment import InterpreterEnvironment
+-from jedi.evaluate.analysis import Warning
+
+
+ def pytest_addoption(parser):
+@@ -85,46 +84,7 @@ def collect_static_analysis_tests(base_dir, test_files):
+ files_to_execute = [a for a in test_files.items() if a[0] in f_name]
+ if f_name.endswith(".py") and (not test_files or files_to_execute):
+ path = os.path.join(base_dir, f_name)
+- yield StaticAnalysisCase(path)
+-
+-
+-class StaticAnalysisCase(object):
+- """
+- Static Analysis cases lie in the static_analysis folder.
+- The tests also start with `#!`, like the goto_definition tests.
+- """
+- def __init__(self, path):
+- self._path = path
+- self.name = os.path.basename(path)
+- with open(path) as f:
+- self._source = f.read()
+-
+- self.skip = False
+- for line in self._source.splitlines():
+- self.skip = self.skip or run.skip_python_version(line)
+-
+- def collect_comparison(self):
+- cases = []
+- for line_nr, line in enumerate(self._source.splitlines(), 1):
+- match = re.match(r'(\s*)#! (\d+ )?(.*)$', line)
+- if match is not None:
+- column = int(match.group(2) or 0) + len(match.group(1))
+- cases.append((line_nr + 1, column, match.group(3)))
+- return cases
+-
+- def run(self, compare_cb, environment):
+- analysis = jedi.Script(
+- self._source,
+- path=self._path,
+- environment=environment,
+- )._analysis()
+- typ_str = lambda inst: 'warning ' if isinstance(inst, Warning) else ''
+- analysis = [(r.line, r.column, typ_str(r) + r.name)
+- for r in analysis]
+- compare_cb(self, analysis, self.collect_comparison())
+-
+- def __repr__(self):
+- return "<%s: %s>" % (self.__class__.__name__, os.path.basename(self._path))
++ yield run.StaticAnalysisCase(path)
+
+
+ @pytest.fixture(scope='session')
+diff --git a/test/run.py b/test/run.py
+index 9e87be27..a42549c6 100755
+--- a/test/run.py
++++ b/test/run.py
+@@ -127,6 +127,7 @@ from jedi.api.completion import get_user_scope
+ from jedi import parser_utils
+ from jedi.api.environment import get_default_environment, get_system_environment
+ from jedi.evaluate.gradual.conversion import convert_contexts
++from jedi.evaluate.analysis import Warning
+
+
+ TEST_COMPLETIONS = 0
+@@ -138,16 +139,8 @@ TEST_USAGES = 3
+ grammar36 = parso.load_grammar(version='3.6')
+
+
+-class IntegrationTestCase(object):
+- def __init__(self, test_type, correct, line_nr, column, start, line,
+- path=None, skip_version_info=None):
+- self.test_type = test_type
+- self.correct = correct
+- self.line_nr = line_nr
+- self.column = column
+- self.start = start
+- self.line = line
+- self.path = path
++class BaseTestCase(object):
++ def __init__(self, skip_version_info=None):
+ self._skip_version_info = skip_version_info
+ self._skip = None
+
+@@ -175,6 +168,19 @@ class IntegrationTestCase(object):
+ operator_, min_version[0], min_version[1]
+ )
+
++
++class IntegrationTestCase(BaseTestCase):
++ def __init__(self, test_type, correct, line_nr, column, start, line,
++ path=None, skip_version_info=None):
++ super(IntegrationTestCase, self).__init__(skip_version_info)
++ self.test_type = test_type
++ self.correct = correct
++ self.line_nr = line_nr
++ self.column = column
++ self.start = start
++ self.line = line
++ self.path = path
++
+ @property
+ def module_name(self):
+ return os.path.splitext(os.path.basename(self.path))[0]
+@@ -277,6 +283,47 @@ class IntegrationTestCase(object):
+ return compare_cb(self, compare, sorted(wanted))
+
+
++class StaticAnalysisCase(BaseTestCase):
++ """
++ Static Analysis cases lie in the static_analysis folder.
++ The tests also start with `#!`, like the goto_definition tests.
++ """
++ def __init__(self, path):
++ self._path = path
++ self.name = os.path.basename(path)
++ with open(path) as f:
++ self._source = f.read()
++
++ skip_version_info = None
++ for line in self._source.splitlines():
++ skip_version_info = skip_python_version(line) or skip_version_info
++
++ super(StaticAnalysisCase, self).__init__(skip_version_info)
++
++ def collect_comparison(self):
++ cases = []
++ for line_nr, line in enumerate(self._source.splitlines(), 1):
++ match = re.match(r'(\s*)#! (\d+ )?(.*)$', line)
++ if match is not None:
++ column = int(match.group(2) or 0) + len(match.group(1))
++ cases.append((line_nr + 1, column, match.group(3)))
++ return cases
++
++ def run(self, compare_cb, environment):
++ analysis = jedi.Script(
++ self._source,
++ path=self._path,
++ environment=environment,
++ )._analysis()
++ typ_str = lambda inst: 'warning ' if isinstance(inst, Warning) else ''
++ analysis = [(r.line, r.column, typ_str(r) + r.name)
++ for r in analysis]
++ compare_cb(self, analysis, self.collect_comparison())
++
++ def __repr__(self):
++ return "<%s: %s>" % (self.__class__.__name__, os.path.basename(self._path))
++
++
+ def skip_python_version(line):
+ # check for python minimal version number
+ match = re.match(r" *# *python *([<>]=?|==) *(\d+(?:\.\d+)?)$", line)
+diff --git a/test/test_integration.py b/test/test_integration.py
+index 04fbd48e..64239048 100644
+--- a/test/test_integration.py
++++ b/test/test_integration.py
+@@ -45,8 +45,9 @@ def test_completion(case, monkeypatch, environment, has_typing):
+
+
+ def test_static_analysis(static_analysis_case, environment):
+- if static_analysis_case.skip is not None:
+- pytest.skip(static_analysis_case.skip)
++ skip_reason = static_analysis_case.get_skip_reason(environment)
++ if skip_reason is not None:
++ pytest.skip(skip_reason)
+ else:
+ static_analysis_case.run(assert_static_analysis, environment)
+
+--
+2.23.0
+
More information about the arch-commits
mailing list