Saravanan666/pypi-org huggingface dataset:
Package: pytest-ranking
pytest-rankingA Pytest plugin for reducing failure detection time of your Python test suite with automated test prioritization/ranking.Thispytestplugin allows you to find failures faster and receive sooner debugging feedback from CI. It speed up the failure detection of your test suite by prioritizing the execution of tests that are faster, recently failed and/or more textually related to code change.InstallationTo installpytest-rankingviapipfromPyPI:pipinstallpytest-rankingUsagePytest will automatically find the plugin and use it when you runpytest. You can use the default prioritization heuristic, which runs tests that have shorter execution time first by passing the--rankoption:pytest--rankThe terminal output will tell you the current configurations and runtime overhead of this plugin. For example:[pytest-ranking] Weights: 1-1-0
[pytest-ranking] History length: 30
[pytest-ranking] Number of files with new hashes: 0
[pytest-ranking] Change relatedness computation time (s): 0.0007872581481933594
[pytest-ranking] Test order computation time(s): 0.00020933151245117188You can configure the weights of different prioritization heuristics by passing the optional--rank-weightflag with formatted values:pytest--rank--rank-weight=0-1-0Weights are separated by hyphens-. The 1st weight is for running faster tests, the 2nd weight is for running recently failed tests, and the 3rd weight is for running tests more textually similar to the changed*.pyfiles in the codebase since the last run.
All weights must be integers or floats, and their sum will be normalized to 1.
A higher weight means that a corresponding heuristic is favored. The default value is1-0-0, only prioritizes faster tests.You can also configure the maximum window size for looking into previous test runs, which is used to compute the number of runs since a test had failed, by passing the optional--rank-hist-lenflag (the default value is 50):pytest--rank--rank-hist-len=30You can always apply these options by adding them to theaddoptssetting in yourpytest.ini.For example, createpytest.iniin your codebase root folder as such:[pytest]addopts=--rank --rank-weight=0-1-0 --rank-hist-len=30and runpyteston command line.Alternatively, you can also createpytest.iniin your codebase root folder as such:[pytest]rank_weight=0-1-0rank_hist_len=30and runpytest --rankon command line.WarningBecausepytest-rankingre-orders tests to speed up failure detection time, please disable other pytest plugins that enforeces other test orders, e.g.,pytest-randomly,pytest-random-order,pytest-reverse.ContributingContributions are very welcome. Tests can be run withtox.LicenseDistributed under the terms of theMITlicense,pytest-rankingis free and open source software.IssuesIf you encounter any problems, pleasefile an issueorpull requestalong with a detailed description.
Package: pytest-reana
Aboutpytest-REANA is a component of theREANAreusable and
reproducible research data analysis platform. It provides pytest fixtures and
test utilities.Featurespytest fixturesmocking OpenAPI client with request format validationmocking Advanced Message Queuing Protocol consumers and producersmocking Celery tasksmocking file system workspace accessmocking database accessincludes sample workspace directoryUsageThe detailed information on how to install and use REANA can be found indocs.reana.io.Useful linksREANA project home pageREANA user documentationREANA user support forumpytest-REANA releasespytest-REANA developer documentationpytest-REANA known issuespytest-REANA source codeChangesVersion 0.9.2 (2023-11-30)Changes CI to use the stable release of Python 3.12.Version 0.9.1 (2023-09-26)Adds support for Python 3.12.Changesapispecdependency version in order to be compatible withPyYAMLv6.Fixes container image fixtures to be Podman-compatible.Fixes Kombu documentation linking.Version 0.9.0 (2022-12-13)Adds fixture providing example of user secrets needed for Kerberos tests.Adds support for Python 3.11.Fixes location of Celery docs for ReadTheDocs pages.Removes hard-dependency onblackcode formatter version.Version 0.8.1 (2022-01-05)Adds support for Python 3.10.Version 0.8.0 (2021-11-22)Adds nested Yadage workflow specification fixture.Adds empty workflow workspaces for sample workflows by default.Adds internal representation of a scatter-gather Snakemake workflow fixture.Changestmp_shared_volume_pathfixture to be configurable through environment variable.Changes fixtures to run with the full workspace path stored in the database.Removes support for Python 2.Version 0.7.2 (2021-07-02)Changes internal dependencies to remove click.Version 0.7.1 (2021-03-17)Adds support for Python 3.9.Fixes minor code warnings.Fixes installation by upgrading REANA-DB version.Version 0.7.0 (2020-10-20)Adds new__reanadatabase schema fordbfixture.Fixes a problem related to duplicated database session.Changes code formatting to respectblackcoding style.Changes documentation to single-page layout.Version 0.6.0 (2019-12-19)Adds fixtures for secrets store.Centralises test requirements.Adds Python 3.8 support.Version 0.5.0 (2019-04-16)Makes workspace path configurable for thesample_workflow_workspacefixture through thepathparameter.Addssample_serial_workflow_in_dbfixture.Exposes previously hiddensample_yadage_workflow_in_dbfixture.Adds missing database session close insessionfixture.Adds helpers to represent starting and requeueing job conditions,sample_condition_for_starting_queued_workflowsandsample_condition_for_requeueing_workflows.Version 0.4.1 (2018-11-06)Adds directory including sample workspace data.Version 0.4.0 (2018-11-06)Initial public release.Please bewarePlease note that REANA is in an early alpha stage of its development. The
developer preview releases are meant for early adopters and testers. Please
don’t rely on released versions for any production purposes yet.
Package: pytest-recorder
1. TL;DR exampleSTEP 1Write this code:File tests/some_module.py@pytest.mark.record_http@pytest.mark.record_time@pytest.mark.record_verify_screendeftest_some_test(record):some_python_object=...record.add_verify(object=some_python_object)STEP 2Run:pytest tests/some_module.py --recordIt will:Save all the  HTTP requestsSave the execution datetimeSave the screen outputSave the data you provide to recorder objectSTEP 3Run:pytest tests/some_module.pyIt will:Reuse the stored HTTP requestsReuse the same datetime to execute the testCompare the current screen output to the previous one and raise and exception if differentCompare the current recorder object data to the previous one and raise and exception if different2. Detailed exampleCODE@pytest.mark.record_http@pytest.mark.record_time(date=datetime(2023,3,1,12,0,0),tic=False)@pytest.mark.record_verify_screen(hash=True)deftest_some_test(record):...record.hash_only=Truerecord.add_verify(object=df)record.add_verify(object=[df])recorder.add_verify(object=df,)USAGEpytest [FILE] [--record[=none,all,http,object,screen,time]] [--record-no-overwrite] [--record-no-hash]FILESFor a given test_function from test_module, we will have the following files:/tests/test_module.py:test_function/tests/record/http/test_module/test_function.yaml/tests/record/object/test_module/test_function.json/tests/record/object_hash/test_module/test_function.txt/json?/tests/record/screen/test_module/test_function.txt/json?/tests/record/screen_hash/test_module/test_function.txt/json?/tests/record/time/test_module/test_function.txt/json?
Package: pytest-redislite
pytest-redislitepytest-redislite-- Is a simplepytestplugin to
help you test your projects usingRedis.FeaturesAutomatically starts/ends Redis for your tests usingRedisliteFlash Redis Database between tests automaticallyRequirementspython >= 3.7Installationpytest-redisliteshould be installed using pip:pip install pytest-redisliteUsageWhen installed the plugin provides the fixture:redis_urldeftest_code_with_redis(redis_url):fromredisimportRedisredis_client=Redis.from_url(redis_url)redis_client.set('key','value')assertredis_client.get('key','value')When you are using the fixture Redis server will be started and finished after
your tests.ConfigurationThe plugins support pytest command line options:--redis-path: Specify a path to Redis Database file--redis-socket-path: Specify a path to Redis Socketas well as pytestinioptions:redis_path: Specify a path to Redis Database fileredis_socket_path: Specify a path to Redis SocketFixturesThe plugin provides the fixtures:redis_server(session scope) provides an instance ofredislite.Redis. The
fixture manages the server's lifetime (start, shutdown).redis_url(session scope) Starts redislite server and provides the server's
socket address.redis_factory(session scope) a context manager to start/shutdown redislite
server.Auto flush data between testsBy default the plugin erases all data in Redis between tests. If you would like
to change the behaviour define the fixture:@pytest.fixturedefredis_autoflash():returnFalseYou may define it for a module or whole tests session.Bug trackerIf you have any suggestions, bug reports or annoyances please report them to
the issue tracker athttps://github.com/klen/pytest-redislite/issuesContributingDevelopment of the project happens at:https://github.com/klen/pytest-redisliteLicenseLicensed under aMIT License
Package: pytest-redmine
pytest-redmine==============[![Build Status](https://travis-ci.org/matisla/pytest-redmine.svg?branch=master)](https://travis-ci.org/matisla/pytest-redmine)[![PyPI Version](https://img.shields.io/pypi/v/pytest-redmine.svg)](https://pypi.python.org/pypi/pytest-redmine)[![PyPI Status](https://img.shields.io/pypi/status/pytest-redmine.svg)](https://pypi.python.org/pypi/pytest-redmine)Installation------------Install the plugin using pip<pre><code class="python">pip install pytest-redmine</code></pre>
Package: pytest-ref
A plugin to store reference files to ease regression testing.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-ref” viapipfromPyPI:$ pip install pytest-refUsageTODOContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense, “pytest-ref” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-regex
pytest-regexUse Python Standard Library Regular Expressions to Specify Tests to RunAfter installing locally with i.e.,python -m pip install .you can
compare it with more conventional test selection techniques as follows.Consider working with SciPy development. Let’s start off by selecting
all tests withtest_3danywhere in their node id, using the conventional/
built-in-kflag:python dev.py test – -v -k “test_3d”This runs a bunch of tests with string matches as you might expect:scipy/io/tests/test_idl.py::TestArrayDimensions::test_3d PASSED
scipy/io/tests/test_idl.py::TestPointerArray::test_3d PASSED
scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py::TestBoxBoundariesIntersections::test_3d_box_constraints PASSED
scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py::TestBoxBoundariesIntersections::test_3d_box_constraints_entire_line PASSED
scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py::TestModifiedDogleg::test_3d_example PASSED
scipy/stats/tests/test_stats.py::TestGeometricStandardDeviation::test_3d_array PASSED
scipy/stats/tests/test_stats.py::TestGeometricStandardDeviation::test_3d_array_axis_type_tuple PASSED
scipy/stats/tests/test_stats.py::TestGeometricStandardDeviation::test_3d_array_axis_0 PASSED
scipy/stats/tests/test_stats.py::TestGeometricStandardDeviation::test_3d_array_axis_1 PASSED
scipy/stats/tests/test_stats.py::TestGeometricStandardDeviation::test_3d_array_axis_2 PASSED
scipy/stats/tests/test_stats.py::TestFOneWay::test_3d_inputs PASSEDWhat if you want to run only tests with an exact match totest_3dortest_3d_example?Trypytest-regexwith:python dev.py test – -v –regex “(.*test_3d$|.*test_3d_example$)”scipy/io/tests/test_idl.py::TestArrayDimensions::test_3d PASSED
scipy/io/tests/test_idl.py::TestPointerArray::test_3d PASSED
scipy/optimize/_trustregion_constr/tests/test_qp_subproblem.py::TestModifiedDogleg::test_3d_example PASSEDThis does what we want, and is probably more concise than the-kalternative. In fact,
I’m not entirely sure how one would do this with-kin its current form.How it Workspytest-regexsimply passes the Python regular expression through
to the list of node ids, where a node id is structured as follows:path/to/test_module.py::TestClass::test_name[parameter_value]If the regex matches the node id, the test is retained and executed.
Package: pytest-regex-dependency
pytest-regex-dependencyManagement of Pytest dependencies via regex patternsInstallationpip install pytest-regex-dependencyUseThe following examples are possible use cases for this pluginTest depends on tests with node Ids matching a specified pattern:test_foo.pyimport pytest
        

def test_a():
    pass

@pytest.mark.regex_dependency('test_foo\.py::test_a')
def test_b():
    passTest depends on all tests within module:test_dependency.pydef test_a():
    pass

def test_b():
    passtest_bar.pyimport pytest
        
@pytest.mark.regex_dependency('test_dependency\.py', target='module')
def test_a():
    passTest depends on all tests within class:import pytest
        

class TestClass:
    def test_a(self):
        pass

@pytest.mark.regex_dependency('TestClass', target="class")
def test_b():
    passTest depends on all tests functions matching a specified pattern:import pytest
        

def test_1():
    pass

def test_2():
    pass

def test_3():
    pass

@pytest.mark.regex_dependency('test_[0-9]+$', target='function')
def test_a():
    passConsiderationsIf a test's pattern is not met, the test function will runIn the following exampletest_bwill run:import pytest
        

def test_a():
    pass

@pytest.mark.regex_dependency('test_1')
def test_b():
    passThe outcome of all phases of a dependency test is consider when determining if the calling test should be skipped. This includes the dependency test's setup, call, and teardown phases. If any of the phases do not match the calling test'sallowed_outcomesrequirement, the test will be skipped. This comes into light when a dependency test's fixture teardown logic fails but the dependency test succeeds.The following is an example of this scenario:import pytest
        

@pytest.fixture
def foo():
    yield None
    pytest.fail()

def test_a(foo):
    pass

@pytest.mark.regex_dependency('test_a', target="function", allowed_outcomes=["passed"])
def test_b():
    pass
Package: pytest-regressions
Fixtures to write regression tests.FeaturesThis plugin makes it simple to test general data, images, files, and numeric tables by savingexpecteddata in adata directory(courtesy ofpytest-datadir) that
can be used to verify that future runs produce the same data.Seethe docsfor examples and API usage.Requirementspytest>=3.5Python 3.6+.InstallationYou can install “pytest-regressions” viapipfromPyPI:$ pip install pytest-regressionsContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense, “pytest-regressions” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.
Package: pytest-relative-order
pytest-relative-ordera pytest plugin that sorts tests using "before" and "after" markersHighlightsConsiderfile.py:import pytest

@pytest.mark.after('test3')
def test1():
    pass

@pytest.mark.before('test3')
def test2():
    pass

def test3():
    passthen if you runpytest file.py, you should get tests executed in the following order:==================================== test session starts ====================================
platform linux -- Python 3.7.9
cachedir: .pytest_cache
rootdir: /home/radek/example, configfile: pytest.ini
plugins: relative-order-0.2
collected 3 items                                                                                                                                                                                        

file.py::test2 PASSED                                                                  [  33%]
file.py::test3 PASSED                                                                  [  33%]
file.py::test1 PASSED                                                                  [  33%]
===================================== 3 passed in 0.02s =====================================DetailsThis plugin introduces two custom markers -beforeandafter. They accept id of test that should precede/follow the marked test.
Marker values are used to sort tests with Kahn's algorithm.Markers usageThe following usages are correct:@pytest.mark.before('test2')
def test1():class TestClass:
  @pytest.mark.before('TestClass::test2')
  def test1():class TestClass:
  @pytest.mark.before('filepath.py::TestClass::test2')
  def test1():@pytest.mark.after('test2', 'test3', 'test4')
def test1():Marker values must be unique, so if there are two different tests namedtest_simple, but they are in two different classes, then class name must be included in the marker value:class TestClass1:
  def test_simple():
[...]
class TestClass2:
  def test_simple():
[...]

@pytest.mark.after('test_simple')  # wrong, ambiguous!
def test_complex1():
[...]

@pytest.mark.after('TestClass2::test_simple')  # correct
def test_complex2():
[...]Of course cycles are forbidden:@pytest.mark.after('test2')
def test1():
[...]
@pytest.mark.after('test1')  # wrong!
def test2():
[...]RemarksPlease keep in mind that the configuration below:file1.py:def test1():
  passfile2.py:import pytest

pytest.mark.before('file1.py::test1')
def test2():
  passfollowed bypytest file1.pywill NOT detecttest2and will not execute it.
Package: pytest-remote-response
This package provides a plugin forpytestframework for capturing and mocking connection requests during the test run.Inspired bypookandpytest-responses.Get started using thedocumentationandgetting-started.🔌Installation$pipinstallpytest-remote-responseor$gitclonehttps://github.com/devanshshukla99/pytest-remote-response$cdpytest-remote-response$pipinstall.The plugin will register automatically withpytestframework and will be ready to use.💁🏻‍♀️Supported ClientsCurrently,pytest-remote-responsesupports,✔urllib✔urllib3✔requests✔aiohttp💨Usage🐍🧪Pytest pluginThe plugin works by applying monkeypatches of interceptors for different libraries using a wrapperresponse.activate.
The interceptors when applied can capture, prevent or mock the connection request.The available interceptors are listed inresponse.availablemethod.Example of using the decorator:importurllib3frompytest_responseimportresponseresponse.configure(remote=True,capture=True,response=False)@response.activate("urllib3")defget_url():http=urllib3.PoolManager()url="https://www.python.org"# Since the interceptors are in response mode, the response data and headers# will be spoofed with saved data in the database;# if the query comes back empty, this request will# error out with :class:`pytest_response.exceptions.ResponseNotFound`res=http.request("GET",url)assertres.status==200assertres.dataHandling requests:Block remote requests:all requests are allowed by default; one can disable them using--remote-blockflag$pytest--remote-blockCapture remote requests:the requests can be captured in asqlite3database using--remote-capturearg$pytest--remote-captureMock remote requests:the requests can be mocked using--remote-response$pytest--remote-response🐱‍👤Standalone packageThe tools implemented in this package can be easily ported to any other application, with mimial config required.Configuration:frompytest_responseimportresponseresponse.setup_database({DUMPFILE})response.post({INTERCEPTOR})...response.unpost()🧪 TestingUsetoxto make sure the plugin is working:$gitclonehttps://github.com/devanshshukla99/pytest-remote-response$cdpytest-remote-response$tox-epy38Seetoxfor more info.LicenceThis plugin is licenced under a MIT licence - see theLICENCEfile.
Package: pytest-remove-stale-bytecode
py.test plugin to remove stale bytecodeDescriptionThis plugin removes stale bytecode files of the packages under test before running tests. This makes
sure that Python modules – whose source was deleted – are not accidentally visible
to the test runner anymore due to a left-over bytecode file (*.pyc,*.pyo).Caution!This plug-in only looks into the packages you are testing. If there is a stale bytecode file
in another package it does not remove it.UsageTo use this plugin you just have to install it, so it is accessible by the
pytest you are using:If you are usingbuildout, addpytest-remove-stale-bytecodeto the
buildout section of your pytest runner.If you are usingpipadd it to your test requirements.Per default, there is no output generated, but if pytest is invoked in verbose
mode (-v), information about the deleted files is printed.This plugin was inspired by a feature ofzope.testrunner.CHANGES6.0 (2023-07-07)Backwards incompatible changesDrop support for Python 3.5 and 3.6.FeaturesAdd support for Python 3.9, 3.10, 3.11.Update tests topytest >= 6.2.Other changesUse Github actions as CI.5.0.1 (2020-03-04)Callingpytest –helpno longer breaks when this plug-in is installed.5.0 (2020-01-17)Backwards incompatible changesDrop support for Python 2.7 and PyPy2.FeaturesAdd support for Python 3.8.Migrate to Github.Improve for new pytest versions.Bug fixesFix problems when running tests jobs in parallel.
(#2)4.0 (2019-09-13)Backwards incompatible changesDrop support for Python 3.4.FeaturesMake work with py.test >=3.10 again.Add support for Python 3.7.3.0.1 (2019-03-21)This plug-in only works in py.test < version 3.10.
It is broken since the merge ofpytest-dev/pytest#4250Drop support for Python 3.3.3.0 (2017-05-12)Add support for Python 3.6, PyPy2 and PyPy3.Do not show output by default anymore. It can be turned on with-voption.Change the license from ZPL to MIT.2.1 (2015-10-01)Also remove bytecode files under Python 3, that end with-PYTEST.2.0 (2015-10-01)Add support for removing byte code files under Python 3.1.0 (2014-10-29)initial release