summaryrefslogtreecommitdiff
blob: 76ca040188e8935bc3ba3de1b561e73b03e1094b (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{7..10} )

inherit distutils-r1

DESCRIPTION="Python language binding for Selenium Remote Control"
HOMEPAGE="https://www.seleniumhq.org"
# pypi tarball misses tests, github tarball misses generated files
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz
	test? (
		https://github.com/SeleniumHQ/selenium/archive/${P}.tar.gz
			-> ${P}.gh.tar.gz
	)"

KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ppc ppc64 ~riscv sparc x86 ~x64-macos"
LICENSE="Apache-2.0"
SLOT="0"

DOCS=( CHANGES README.rst )

QA_PREBUILT="/usr/lib*/python*/site-packages/${PN}/webdriver/firefox/*/x_ignore_nofocus.so"

RDEPEND="
	dev-python/urllib3[${PYTHON_USEDEP}]"
BDEPEND="
	test? ( dev-python/pytest-mock[${PYTHON_USEDEP}] )"

distutils_enable_tests pytest

src_unpack() {
	unpack "${P}.tar.gz"
	if use test; then
		cd "${S}" || die
		ebegin "Unpacking tests from ${P}.gh.tar.gz"
		tar -x -z -f "${DISTDIR}/${P}.gh.tar.gz" --strip-components 2 \
			"${PN}-${P}"/py/test
		eend ${?} || die
	fi
}

python_test() {
	pytest -vv test/unit || die "Tests fail with ${EPYTHON}"
}