summaryrefslogtreecommitdiff
blob: 9055afa88c2c2d044de77fe86d38751b9272eaf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
PYTHON_COMPAT=( python3_{6,7} )

inherit distutils-r1

DESCRIPTION="Autocompletion library for Python"
HOMEPAGE="https://github.com/davidhalter/jedi"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~arm ~arm64 ~ppc ppc64 x86"

RDEPEND="dev-python/parso[${PYTHON_USEDEP}]"

distutils_enable_tests pytest
distutils_enable_sphinx docs

python_prepare_all() {
	# speed tests are fragile
	rm test/test_speed.py || die

	# 'path' completion test does not account for 'path' being a valid
	# package (i.e. dev-python/path-py)
	# https://github.com/davidhalter/jedi/issues/1210
	sed -i -e 's:test_get_modules_containing_name:_&:' \
		test/test_evaluate/test_imports.py || die
	sed -i -e 's:test_os_issues:_&:' \
		test/test_evaluate/test_imports.py || die
	sed -i -e 's:test_os_issues:_&:' \
		test/test_api/test_full_name.py || die
	sed -i -e 's:test_os_nowait:_&:' \
		test/test_api/test_full_name.py || die
	sed -i -e 's:test_os_nowait:_&:' \
		test/test_api/test_completion.py || die
	sed -i -e 's:test_import:_&:' \
		test/test_utils.py || die

	# don't run doctests, don't depend on colorama
	sed -i "s:'docopt',:: ; s:'colorama',::" setup.py || die
	sed -i "s: --doctest-modules::" pytest.ini || die

	# no clue why it fails but we don't really care about .pyc files
	# without sources anyway
	rm test/test_evaluate/test_pyc.py || die

	distutils-r1_python_prepare_all
}

python_test() {
	if [[ ${EPYTHON} = python3.6 ]]; then
		# our very useful patching changes libdir for no good reason
		sed -i -e 's:test_venv_and_pths:_&:' \
			test/test_evaluate/test_sys_path.py || die
	fi

	pytest -vv || die "Tests fail with ${EPYTHON}"
}