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

EAPI=8

PYTHON_COMPAT=( python3_{9..11} pypy3 )
DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1

DESCRIPTION="Test doubles for Python"
HOMEPAGE="https://github.com/uber/doubles"
SRC_URI="https://github.com/uber/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"

SLOT="0"
LICENSE="MIT"
KEYWORDS="~amd64"

RDEPEND="dev-python/six[${PYTHON_USEDEP}]"
BDEPEND="
	test? (
		dev-python/nose[${PYTHON_USEDEP}]
	)
"

DOCS=( CHANGES.rst CONTRIBUTING.rst README.rst )

distutils_enable_sphinx docs/source dev-python/sphinx-rtd-theme
distutils_enable_tests pytest

EPYTEST_DESELECT=(
	test/allow_test.py::TestTwice::test_fails_when_called_three_times
	test/allow_test.py::TestOnce::test_fails_when_called_two_times
	test/allow_test.py::TestZeroTimes::test_fails_when_called_once_times
	test/allow_test.py::TestExactly::test_called_with_zero
	test/allow_test.py::TestExactly::test_fails_when_called_more_than_expected_times
	test/allow_test.py::TestAtMost::test_fails_when_called_more_than_at_most_times
	test/class_double_test.py::TestClassDouble::test_raises_when_stubbing_instance_methods
	test/expect_test.py::TestExpect::test_with_args_validator_not_called
	test/expect_test.py::TestExpect::test_raises_if_an_expected_method_call_without_args_is_not_made
	test/expect_test.py::TestExpect::test_raises_if_an_expected_method_call_with_args_is_not_made
	test/expect_test.py::TestExpect::test_raises_if_an_expected_method_call_with_default_args_is_not_made
	test/expect_test.py::TestTwice::test_fails_when_called_once
	test/expect_test.py::TestTwice::test_fails_when_called_three_times
	test/expect_test.py::TestOnce::test_fails_when_called_two_times
	test/expect_test.py::TestExactly::test_fails_when_called_less_than_expected_times
	test/expect_test.py::TestExactly::test_fails_when_called_more_than_expected_times
	test/expect_test.py::TestAtLeast::test_fails_when_called_less_than_at_least_times
	test/expect_test.py::TestAtMost::test_fails_when_called_more_than_at_most_times
	test/expect_test.py::Test__call__::test_unsatisfied_expectation
	test/expect_test.py::Test__enter__::test_unsatisfied_expectation
	test/expect_test.py::Test__exit__::test_unsatisfied_expectation
	test/object_double_test.py::TestObjectDouble::test_raises_when_stubbing_nonexistent_methods
	test/object_double_test.py::TestObjectDouble::test_raises_when_stubbing_noncallable_attributes
	test/pytest_test.py
)

python_prepare() {
	# attempts to import "coverage"
	echo "pytest_plugins = ['doubles.pytest_plugin']" > test/conftest.py || die

	# "Distribution information not found. Run 'setup.py develop'"
	sed "s/pkg_resources.get_distribution.*/'${PV}'/" -i docs/source/conf.py || die
}

python_test() {
	epytest -p no:doubles test
}