From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B7226138350 for ; Sat, 25 Apr 2020 00:37:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E6DA9E0C01; Sat, 25 Apr 2020 00:37:30 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C2862E0BFE for ; Sat, 25 Apr 2020 00:37:30 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2E2F034F1B7 for ; Sat, 25 Apr 2020 00:37:29 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6A79B213 for ; Sat, 25 Apr 2020 00:37:25 +0000 (UTC) From: "Alessandro Barbieri" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alessandro Barbieri" Message-ID: <1587775037.3b9a4b6ca84a7479a0ed441b761fd425311141f5.Alessandro-Barbieri@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: dev-python/pytest-randomly/ X-VCS-Repository: repo/proj/guru X-VCS-Files: dev-python/pytest-randomly/Manifest dev-python/pytest-randomly/metadata.xml dev-python/pytest-randomly/pytest-randomly-3.3.1.ebuild X-VCS-Directories: dev-python/pytest-randomly/ X-VCS-Committer: Alessandro-Barbieri X-VCS-Committer-Name: Alessandro Barbieri X-VCS-Revision: 3b9a4b6ca84a7479a0ed441b761fd425311141f5 X-VCS-Branch: dev Date: Sat, 25 Apr 2020 00:37:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 85726123-747f-4281-9b2b-937f4b9392dd X-Archives-Hash: cbe13f20ee1dfffebe75d922719b7a5b commit: 3b9a4b6ca84a7479a0ed441b761fd425311141f5 Author: Alessandro Barbieri gmail com> AuthorDate: Sat Apr 25 00:08:22 2020 +0000 Commit: Alessandro Barbieri gmail com> CommitDate: Sat Apr 25 00:37:17 2020 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3b9a4b6c dev-python/pytest-randomly: new package Package-Manager: Portage-2.3.99, Repoman-2.3.22 Signed-off-by: Alessandro Barbieri gmail.com> dev-python/pytest-randomly/Manifest | 1 + dev-python/pytest-randomly/metadata.xml | 34 ++++++++++++++++ .../pytest-randomly/pytest-randomly-3.3.1.ebuild | 46 ++++++++++++++++++++++ 3 files changed, 81 insertions(+) diff --git a/dev-python/pytest-randomly/Manifest b/dev-python/pytest-randomly/Manifest new file mode 100644 index 0000000..8c9c377 --- /dev/null +++ b/dev-python/pytest-randomly/Manifest @@ -0,0 +1 @@ +DIST pytest-randomly-3.3.1.tar.gz 31404 BLAKE2B 28a77b2c7043ece3305e1971957b23a7188bf1889483c9747f2fe925bfe72e872d8e8f4a52e3dc372f9934dd81c3e88bbc9be52bc574605faed80e57fa852d3c SHA512 242274b1e9fcbb03278766ddd46e8d3dca2374f09db0d111feb0bebdabab4d46ecc63d17f17e692cf4adf662dd3b450f87fe14e248488acb4d3c629567d54458 diff --git a/dev-python/pytest-randomly/metadata.xml b/dev-python/pytest-randomly/metadata.xml new file mode 100644 index 0000000..46c4254 --- /dev/null +++ b/dev-python/pytest-randomly/metadata.xml @@ -0,0 +1,34 @@ + + + + + lssndrbarbieri@gmail.com + Alessandro Barbieri + + +Features + +All of these features are on by default but can be disabled with flags. + + 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. + 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. + 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. + 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. + If numpy is installed, its random state is reset at the start of every test. + 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. + Works with pytest-xdist. + +About + +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. + +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. + +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. + +This plugin is a Pytest port of my plugin for nose, nose-randomly. I’ve written a blog post on its history. + + + pytest-dev/pytest-randomly + + diff --git a/dev-python/pytest-randomly/pytest-randomly-3.3.1.ebuild b/dev-python/pytest-randomly/pytest-randomly-3.3.1.ebuild new file mode 100644 index 0000000..2796f69 --- /dev/null +++ b/dev-python/pytest-randomly/pytest-randomly-3.3.1.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" + +DISTUTILS_USE_SETUPTOOLS=rdepend +PYTHON_COMPAT=( python3_{6,7,8} ) + +inherit distutils-r1 + +DESCRIPTION="Pytest plugin to randomly order tests and control random.seed" +HOMEPAGE=" + https://pypi.python.org/pypi/pytest-randomly + https://github.com/pytest-dev/pytest-randomly +" +SRC_URI="https://github.com/pytest-dev/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" +RESTRICT="test" + +RDEPEND=" + dev-python/docutils[${PYTHON_USEDEP}] + dev-python/factory_boy[${PYTHON_USEDEP}] + dev-python/faker[${PYTHON_USEDEP}] + dev-python/isort[${PYTHON_USEDEP}] + dev-python/numpy[${PYTHON_USEDEP}] + dev-python/pygments[${PYTHON_USEDEP}] + dev-python/secretstorage[${PYTHON_USEDEP}] + dev-python/twine[${PYTHON_USEDEP}] + + $(python_gen_cond_dep 'dev-python/black[${PYTHON_USEDEP}]' python3_8) + $(python_gen_cond_dep 'dev-python/importlib_metadata[${PYTHON_USEDEP}]' python3_6 python3_7) +" +#DEPEND=" +# test? ( +# $(python_gen_cond_dep 'dev-python/check-manifest[${PYTHON_USEDEP}]' python3_8) +# dev-python/multilint[${PYTHON_USEDEP}] +# dev-python/pytest-xdist[${PYTHON_USEDEP}] +# ) +#" + +#no multilint for now +#distutils_enable_tests pytest