Package: nose-randomly
Unmaintained:I’m no longer maintaining this package because I haven’t used
nose for some time, and nose itself has not seen a release since 2015, nor a
commit since 2016 (nearly 3 years at time of writing). If you want to continue
maintenance please contact me.Nose plugin to randomly order tests and controlrandom.seed. (Also
availablefor pytest).FeaturesAll of these features are on by default but can be disabled with flags.Randomly shuffles the submodules,TestCaseclasses + test functions when
loading a module of tests.Randomly shuffles the test functions inside aTestCasewhen loading it.Resetsrandom.seed()at the start of every test case and test to a fixed
number - this defaults totime.time()from the start of your test run,
but you can pass in--randomly-seedto repeat a randomness-induced
failure.Iffactory boyis installed, its random state is reset at the start of every test. This
allows for repeatable use of its random ‘fuzzy’ features.Iffakeris 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.AboutRandomness 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
runnergoogletest.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.RequirementsTested with:Python 2.7, 3.6The latest version of NoseUsageInstall from pip with:pipinstallnose-randomlyNose will automatically find the plugin.To activate it on your test run, use the--with-randomlyflag, for example:nosetests-v--with-randomlyThe output will start with an extra line that tells you the random seed that is
being used:Using--randomly-seed=1234test_D(abcd_tests.Tests)...ok...If the tests then fail due to ordering or randomly created data, you can then
restart them with that seed:nosetests-v--with-randomly--randomly-seed=1234You can disable behaviours you don’t like with the following flags:--randomly-dont-shuffle-modules- turn off the shuffling of the contents
of modules--randomly-dont-shuffle-cases- turn off the shuffling of test functions
insideTestCaseclasses--randomly-dont-reset-seed- turn off the reset ofrandom.seed()at
the start of every testBackgroundnosehas anunmerged pull requestfrom 2009 to add
random ordering functionality. This is available in plugin format in thenose-randomizepackage. It
works quite well but I found that since it replaces all of the test loading
machinery insidenose, it can interact badly with other plugins. This plugin
was developed as a thinner layer to achieve the same thing, plus the random
seed resetting which was not available before.LicenseBSD licensed, see LICENSE fileLogo by Christian Mohr from the Noun Project
(link).HistoryPending release1.2.6 (2019-02-07)Update PyPI development status as inactive. This package is no longer
maintained, see README.rst.Dropped Python 2.6 compatibility, as upstream dependency NumPy did.1.2.5 (2016-10-28)Set a high plugin score to ensure thatnose-randomlyis loaded before
other plugins. This fixes a bug where randomization would disapper when using
thedoctestsplugin that is included with Nose.1.2.4 (2016-10-27)Reset the random state for NumPy too.1.2.3 (2016-08-19)Fixed output so the random seed is always output when the plugin is enabled,
not just when resettingrandom.seed()at the start of tests. Thanks
@amygdalama.1.2.2 (2016-07-06)Fixed to work withpython setup.py nosetestson Python 2 due to issue
withunicodenot working withdistutils.fancy_getopt.1.2.1 (2016-06-01)Support test generators.1.2.0 (2015-12-10)Reset the random state for Faker (pip packagefake-factory) too1.1.0 (2015-08-27)Reset the random seed at the start of nose test contexts (TestCases
etc.) tooSlight performance improvement by always usingrandom.setstate()for
reseeding1.0.0 (2015-07-23)First release on PyPI.