Gentoo Archives: gentoo-commits

From: Alessandro Barbieri <lssndrbarbieri@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: dev-python/pytest-randomly/
Date: Sat, 25 Apr 2020 00:37:35
Message-Id: 1587775037.3b9a4b6ca84a7479a0ed441b761fd425311141f5.Alessandro-Barbieri@gentoo
1 commit: 3b9a4b6ca84a7479a0ed441b761fd425311141f5
2 Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
3 AuthorDate: Sat Apr 25 00:08:22 2020 +0000
4 Commit: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
5 CommitDate: Sat Apr 25 00:37:17 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3b9a4b6c
7
8 dev-python/pytest-randomly: new package
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>
12
13 dev-python/pytest-randomly/Manifest | 1 +
14 dev-python/pytest-randomly/metadata.xml | 34 ++++++++++++++++
15 .../pytest-randomly/pytest-randomly-3.3.1.ebuild | 46 ++++++++++++++++++++++
16 3 files changed, 81 insertions(+)
17
18 diff --git a/dev-python/pytest-randomly/Manifest b/dev-python/pytest-randomly/Manifest
19 new file mode 100644
20 index 0000000..8c9c377
21 --- /dev/null
22 +++ b/dev-python/pytest-randomly/Manifest
23 @@ -0,0 +1 @@
24 +DIST pytest-randomly-3.3.1.tar.gz 31404 BLAKE2B 28a77b2c7043ece3305e1971957b23a7188bf1889483c9747f2fe925bfe72e872d8e8f4a52e3dc372f9934dd81c3e88bbc9be52bc574605faed80e57fa852d3c SHA512 242274b1e9fcbb03278766ddd46e8d3dca2374f09db0d111feb0bebdabab4d46ecc63d17f17e692cf4adf662dd3b450f87fe14e248488acb4d3c629567d54458
25
26 diff --git a/dev-python/pytest-randomly/metadata.xml b/dev-python/pytest-randomly/metadata.xml
27 new file mode 100644
28 index 0000000..46c4254
29 --- /dev/null
30 +++ b/dev-python/pytest-randomly/metadata.xml
31 @@ -0,0 +1,34 @@
32 +<?xml version="1.0" encoding="UTF-8"?>
33 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
34 +<pkgmetadata>
35 + <maintainer type="person">
36 + <email>lssndrbarbieri@×××××.com</email>
37 + <name>Alessandro Barbieri</name>
38 + </maintainer>
39 + <longdescription lang="en">
40 +Features
41 +
42 +All of these features are on by default but can be disabled with flags.
43 +
44 + Randomly shuffles the order of test items. This is done first at the level of modules, then at the level of test classes (if you have them), then at the order of functions. This also works with things like doctests.
45 + Resets random.seed() at the start of every test case and test to a fixed number - this defaults to time.time() from the start of your test run, but you can pass in --randomly-seed to repeat a randomness-induced failure.
46 + If factory boy is installed, its random state is reset at the start of every test. This allows for repeatable use of its random ‘fuzzy’ features.
47 + If faker is installed, its random state is reset at the start of every test. This is also for repeatable fuzzy data in tests - factory boy uses faker for lots of data.
48 + If numpy is installed, its random state is reset at the start of every test.
49 + If additional random generators are used, they can be registered under the pytest_randomly.random_seeder entry point and will have their seed reset at the start of every test. Register a function that takes the current seed value.
50 + Works with pytest-xdist.
51 +
52 +About
53 +
54 +Randomness in testing can be quite powerful to discover hidden flaws in the tests themselves, as well as giving a little more coverage to your system.
55 +
56 +By randomly ordering the tests, the risk of surprising inter-test dependencies is reduced - a technique used in many places, for example Google’s C++ test runner googletest.
57 +
58 +By resetting the random seed to a repeatable number for each test, tests can create data based on random numbers and yet remain repeatable, for example factory boy’s fuzzy values. This is good for ensuring that tests specify the data they need and that the tested system is not affected by any data that is filled in randomly due to not being specified.
59 +
60 +This plugin is a Pytest port of my plugin for nose, nose-randomly. I’ve written a blog post on its history.
61 + </longdescription>
62 + <upstream>
63 + <remote-id type="github">pytest-dev/pytest-randomly</remote-id>
64 + </upstream>
65 +</pkgmetadata>
66
67 diff --git a/dev-python/pytest-randomly/pytest-randomly-3.3.1.ebuild b/dev-python/pytest-randomly/pytest-randomly-3.3.1.ebuild
68 new file mode 100644
69 index 0000000..2796f69
70 --- /dev/null
71 +++ b/dev-python/pytest-randomly/pytest-randomly-3.3.1.ebuild
72 @@ -0,0 +1,46 @@
73 +# Copyright 1999-2020 Gentoo Authors
74 +# Distributed under the terms of the GNU General Public License v2
75 +
76 +EAPI="7"
77 +
78 +DISTUTILS_USE_SETUPTOOLS=rdepend
79 +PYTHON_COMPAT=( python3_{6,7,8} )
80 +
81 +inherit distutils-r1
82 +
83 +DESCRIPTION="Pytest plugin to randomly order tests and control random.seed"
84 +HOMEPAGE="
85 + https://pypi.python.org/pypi/pytest-randomly
86 + https://github.com/pytest-dev/pytest-randomly
87 +"
88 +SRC_URI="https://github.com/pytest-dev/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
89 +
90 +LICENSE="BSD"
91 +SLOT="0"
92 +KEYWORDS="~amd64 ~x86"
93 +IUSE="test"
94 +RESTRICT="test"
95 +
96 +RDEPEND="
97 + dev-python/docutils[${PYTHON_USEDEP}]
98 + dev-python/factory_boy[${PYTHON_USEDEP}]
99 + dev-python/faker[${PYTHON_USEDEP}]
100 + dev-python/isort[${PYTHON_USEDEP}]
101 + dev-python/numpy[${PYTHON_USEDEP}]
102 + dev-python/pygments[${PYTHON_USEDEP}]
103 + dev-python/secretstorage[${PYTHON_USEDEP}]
104 + dev-python/twine[${PYTHON_USEDEP}]
105 +
106 + $(python_gen_cond_dep 'dev-python/black[${PYTHON_USEDEP}]' python3_8)
107 + $(python_gen_cond_dep 'dev-python/importlib_metadata[${PYTHON_USEDEP}]' python3_6 python3_7)
108 +"
109 +#DEPEND="
110 +# test? (
111 +# $(python_gen_cond_dep 'dev-python/check-manifest[${PYTHON_USEDEP}]' python3_8)
112 +# dev-python/multilint[${PYTHON_USEDEP}]
113 +# dev-python/pytest-xdist[${PYTHON_USEDEP}]
114 +# )
115 +#"
116 +
117 +#no multilint for now
118 +#distutils_enable_tests pytest