summaryrefslogtreecommitdiff
blob: a1d1d280c8a058407f5b5fffc710467f2a7069be (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
62
63
64
65
66
67
68
69
70
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{7..8} )
DISTUTILS_USE_SETUPTOOLS=rdepend

inherit distutils-r1

DESCRIPTION="In-process task scheduler with Cron-like capabilities"
HOMEPAGE="https://github.com/agronholm/apscheduler"
SRC_URI="mirror://pypi/A/${PN}/${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="dev-python/pytz[${PYTHON_USEDEP}]
	>=dev-python/six-1.4.0[${PYTHON_USEDEP}]
	>=dev-python/tzlocal-1.2[${PYTHON_USEDEP}]"
DEPEND="${RDEPEND}
	test? (
		dev-python/pytest[${PYTHON_USEDEP}]
		www-servers/tornado[${PYTHON_USEDEP}]
	)"

# Tests that are known to fail (some may be triggered by network-sandbox).
test_failures=(
	test_add_class_method_job
	test_add_instance_method_job
	test_add_job_conflicting_id
	test_asyncio_executor_shutdown
	test_get_all_jobs
	test_get_next_run_time
	test_get_pending_jobs
	test_get_pending_jobs_subsecond_difference
	test_lookup_job
	test_lookup_nonexistent_job
	test_one_job_fails_to_load
	test_remove_all_jobs
	test_remove_job
	test_remove_nonexistent_job
	test_repr_mongodbjobstore
	test_repr_redisjobstore
	test_repr_zookeeperjobstore
	test_run_coroutine_job
	test_run_coroutine_job_tornado
	test_update_job
	test_update_job_clear_next_runtime
	test_update_job_next_runtime
	test_update_job_nonexistent_job
	test_zookeeper_client_keep_open
	test_zookeeper_client_ref
)

python_prepare_all() {
	sed -i -e /setuptools_scm/d setup.py || die
	while read -r -d ''; do
		sed -Ee "s:$(echo "${test_failures[@]}"| sed 's: :|:g'):_\\0:" -i "${REPLY}" || die
	done < <(grep -rElZ "$(echo "${test_failures[@]}"| sed 's: :|:g')" "${S}")

	distutils-r1_python_prepare_all
}

python_test() {
	py.test || die "Testing failed with ${EPYTHON}"
}