Saravanan666/pypi-org huggingface dataset:
Package: pytest-beds
Convenience plugin on top of the testbed the Google Appengine (GAE) SDK already provides.Installpip installpytest-bedsAfter that the plugin is enabled by default. You can use specific fixtures (see below) to activate the Testbed and stub specific services.Options--no-gaeDisable the plugin, esp. do not change the python paths and try to import dev_appserver.--sdk-pathPATHThe plugin assumes it can justimport dev_apserver. If that fails it looks up the SDK path in the environment variableGAE. Otherwise, you can specify the path to the SDK by using the--sdk-pathPATHoption.--project-rootPATHSecondly, the plugin assume that your current path is the projects root folder, t.i. the dirctory which holds the app.yaml. You can specify a different path using--project-rootPATH.--noisy-taskletsBy default the plugin shortens the tracebacks when using ndb tasklets, so they don’t include the eventloop’s internal noise.
Use this switch to make ndb noisy again.FixturesThe plugin provides fixtures to stub the different services. Usage is therefore simple and straightforward:# Say, if you create a Foo you hit the database and put some work on queue
def test_foo(ndb, taskqueue):
    foo = Foo.create()

    assert Foo.query().fetch() == [foo]List of builtin fixtures:bed
mailer
channel
urlfetch
memcache
taskqueue
blobstore
ndb
usersUsersThere are two fixturesanonymousandloginto handle the users-stub.anonymousPrepares the user stub so thatusers.get_current_user()will return NoneloginPrepares the user stub and returns a function to login actual users:def test_login(login):
    # at this point users.get_current_user() will return None

    login(id=1, email='foo@gmail.com')
    # now users.get_current_user() will return a user

    login.logout()
    # now users.get_current_user() will return None againDeferredsThedeferredsfixture inits the taskqueue stub, but returns a useful object, so you can actually run the deferred functions:def test_work(deferreds):
    deferred.defer(work, 'to be done')

    deferreds.consume()

    assert 'work has been done'
Package: pytest-beeprint
Better diffs inpytestassertion error messages usingbeeprintandICDiff.Usagepip install pytest-beeprintOnce you’ve installed it,pytestwill produce nice colourised diffs for anyassert ==:Issues and PRs welcome.Thanks to the maintainers ofpytest-icdiff,ICDiffand alsobeeprint!LicenseDistributed under the terms of theUnlicenselicense, “pytest-beeprint” is free and open source softwareThispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.History0.1.2 (2023-07-04)Fix how to set cols size for tests0.1.1 (2023-06-08)Fix README0.1.0 (2023-06-09)Forked from:https://github.com/hjwp/pytest-icdiffChanged to use beeprint insteadFix Tests
Package: pytest-better-parametrize
A wrapper around pytest.mark.parametrize that allows better description of test casesThispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-better-parametrize” viapipfromPyPI:$ pip install pytest-better-parametrizeUsageTODOContributingContributions 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-better-parametrize” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-bg-process
pytest-bg-processPytest plugin to initialize background process.The process will start once before all the tests usingsubprocess.Popenand will be killed once all the tests finished.Installationpip install pytest-bg-processConfigurationFrompytest configuration:background-cmd:Path to command to run at backgroundDefault: Nonebackground-cmd-env:Environmental variable to path to command to run at background.Has higher priority than background-cmd.Default: Nonebackground-pid:Path to save PID data of the background process.Default: background.pidbackground-log:Path to save log data of the background process.Default: background.logExampleUsing background-cmd[pytest]background-cmd=redis-serverbackground-pid=redis.pidbackground-log=redis.logUsing background-cmd-env[pytest]background-cmd-env=REDIS_CMDbackground-pid=redis.pidbackground-log=redis.logthenREDIS_CMD=redis-server&&pytest
Package: pytest-bigchaindb
WARNING: Scaffolding only. Not Yet Implemented!pytest-bigchaindbA BigchainDB plugin for pytest.FeaturesTODORequirementsTODOInstallationOnce implemented, you can install “pytest-bigchaindb” viapipfromPyPI:$ pip install pytest-bigchaindbUsageTODOContributingContributions 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-bigchaindb” is free
and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed
description.Special ThanksThisPytestplugin was started withCookiecutteralong with@hackebrot’sCookiecutter-pytest-plugintemplate.
Package: pytest-bigquery-mock
pytest-bigquery-mockPytest plugin that provides abq_client_mockfixture.
This fixture mocks thegoogle.cloud.bigquery.Clientclass and provides a way to mock an API response usingpytest.mark, for example:Install and useInstall the plugin withpip install pytest-bigquery-mockThen, in yourconftest.pyfile addpytest-bigquery-mockto your list of pluginsplugins = ["pytest-bigquery-mock"]This allows you to use thebq_client_mockfixture in your pytest tests.def function_that_calls_bigquery(bq_client):
    row_iter = bq_client.query("SELECT * FROM table").result()
    return row_iter


@pytest.mark.bq_query_return_data(
    [
        {
            "query": "SELECT * FROM table",
            "table": {
                "columns": [
                    "id_row",
                    "name",
                ],
                "rows": [
                    [1, "Alice"],
                    [2, "Pete"],
                    [3, "Steven"],
                ],
            },
        },
    ]
)
def test_function_that_calls_bigquery(bq_client_mock):
    row_iter = function_that_calls_bigquery(bq_client_mock)

    expected_row_dicts = [
        {"id_row": 1, "name": "Alice"},
        {"id_row": 2, "name": "Pete"},
        {"id_row": 3, "name": "Steven"},
    ]
    for row, expected_row in zip(row_iter, expected_row_dicts):
        assert dict(row) == expected_row
Package: pytest-bisect-tests
pytest-bisect-testsSometimes one test can affect the execution of another test. This simple script tries to find the offender.This script can be called as standalone script, or via pytest option.Example:# faulty_test.pya=1deftest_faulty()->None:globalaa=2deftest_failing()->None:asserta==1$pytest-bisect-tests--failing-test"faulty_test.py::test_failing"Checkingifthetestfailsonitsown.Running1tests.Tryingtofindthefaultytest.Running2tests.Faultytest:faulty_test.py::test_faultyComparison of UXStandalone script:pytest option:Installation$pipinstallpytest-bisect-testsUsageStandalone script$pytest-bisect-tests--failing-test"<identifier of the test as pytest shows them with -v>"Additional arguments:$pytest-bisect-tests--help
usage:pytest-bisect-tests[-h]--failing-testFAILING_TEST[--run-optionsRUN_OPTIONS][--collect-optionsCOLLECT_OPTIONS][--stdout]options:-h,--helpshowthishelpmessageandexit--failing-testFAILING_TESTREQUIRED.Theidentifierofthetest,asshownbypytest-v.--run-optionsRUN_OPTIONSArgumentsthatwillbepasseddirectlytopytest.Asinglestring.--collect-optionsCOLLECT_OPTIONSArgumentsthatwillbepassedtopytestduringtestscollection.Asinglestring.Thisisusefulwhen,forexample,youhaveatestgroupingpluginthataffectsthetestsrun.--stdoutIfpassed,pytestoutputwillbeshown.As pytest optionThis approach automatically discovers all tests in the suite and failing test, so it has minimal input options.$pytest--bisect-first-failureAlternativesdetect-test-pollution, an alternative package with similar functionality.
Lacks passing pytest run and collect options or showing the output from pytest. It also doesn't support pytest plugins that alter
how tests are collected (likepytest-test-groups).
Package: pytest-black
pytest-blackA pytest plugin to enable format checking withblack.RequirementspytestblackThere is a minimum requirement of black 19.3b0 or later.Installation$ pip install pytest-blackUsageTo run pytest with formatting checks provided by black:$ pytest --blackThe plugin will output a diff of suggested formatting changes (if any exist). Changes willnotbe applied automatically.ConfigurationYou can override default black configuration options by placing apyproject.tomlfile in your project directory. See example configurationhere.Python package managementForpoetryto work correctly, include this in your pyproject.toml configuration file:[tool.poetry.dev-dependencies]
...
black = { version = "*", allow-prereleases = true }
...This is necessary because at the time of writing all theblackreleases in PyPI have been tagged as pre-releases (beta code), which breakspoetry's dependency resolution.TestingTo run the tests against a selection of Python interpreters:$ toxTo run against a specific interpreter (e.g. Python 3.6):$ tox -e py36Thetox.inifile in the root of this repository is used to configure the test environment.LicenseDistributed under the terms of theMITlicense,pytest-blackis free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-black-ng
pytest-black-ngA pytest plugin to enable format checking withblack.This is a fork of the originalpytest-blackplugin by ShopKeep Inc to provide an up-to-date version of this plugin.RequirementspytestblackThere is a minimum requirement of black 22.1.0 or later.Installation$ pip install pytest-black-ngUsageTo run pytest with formatting checks provided by black:$ pytest --blackThe plugin will output a diff of suggested formatting changes (if any exist). Changes willnotbe applied automatically.ConfigurationYou can override default black configuration options by placing apyproject.tomlfile in your project directory. See example configurationhere.TestingTo run the tests, simply run:$ pytest
$ flake8CI takes care of running this against a selecting of Python versions.LicenseDistributed under the terms of theMITlicense,pytest-black-ngis free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-blink1
# pytest-blink1![Build Status](https://secure.travis-ci.org/vmalloe/pytest-blink1.png?branch=master)A pytest plugin to emit notifications via the [Blink(1) RGB LED](https://blink1.thingm.com/)## InstallationYou can install “pytest-blink1” via pip from PyPI:` $ pip installpytest-blink1`After this, make sure you’re running the API server via the blink1control utility.## LicenseDistributed under the terms of the MIT license, “pytest-blink1” is free and open source software
Package: pytest-blockage
pytest-blockageDisable SMTP and HTTP requests during a test run.Based mainly onhttps://github.com/andymckay/nose-blockage; source is
available athttps://github.com/rob-b/pytest-blockageInstallationThe plugin can be installed viapypi:$ pip install pytest-blockageUsageTo activate the plugin the--blockageparameter should be passed. e.g.:$ py.test package --blockageYou can whitelist specific hosts:$ py.test package --blockage --blockage-http-whitelist=some_site --blockage-smtp-whitelist=fake_smtpConfigurationAll settings can be stored in your pytest file, with the same variable names as
the argument names mentioned under usage:blockage=true
blockage-http-whitelist=some_site
blockage-smtp-whitelist=fake_smtpChangelog0.2.3 (2021-12-21)FIX: sdist package was broken0.2.2 (2019-02-13)FIX: SMTP whitelisting works with python3 as well0.2.1 (2018-12-01)HTTP whitelistingSMTP whitelisting0.2.0 (2015-06-22)Added python 3 support0.1 (2013-05-11)Initial Release
Package: pytest-board
# pytest-board – Continuous pytest runner with awesome visualizationpytest-boardis a testing visualization tool for pytest runner. Works withptb. Use it instead ofpy.test.![](https://github.com/kuss/pytest-board/raw/master/docs/pytest_board_screenshot.png)## Installation$ pip install pytest-board## UsageYou can just use instead of pytest runner.$ ptbWatch the test results display in your browser at:http://localhost:8080## MotivationThis project is inspired by [GoConvey](https://github.com/smartystreets/goconvey). Some code are from other libraries:[GoConvey](https://github.com/smartystreets/goconvey)[pytest-watch](https://github.com/joeyespo/pytest-watch)[pytest-json-report](https://github.com/numirias/pytest-json-report)## LicenseThis software is licensed under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
Package: pytest-boost-xml
This plugin generates report in the boost format, containing informations about passed assertions and extra information messages.InstallationInstall with pip:pip install pytest-boost-xmlUninstallingUninstall with pip:pip uninstall pytest-boost-xmlUsagepytest.ini file must be configured with pytest_assertion_pass hook activated:[pytest]
enable_assertion_pass_hook=truepytest command line parameters are:pytest --boost_xml=path_to_reports [--boost_xml_filename=report_file_name] [--boost_xml_report_title=report_title]with:report_file_name: base name for generated files. Default is ‘boostReport’report_title: title of generated report files. Default is ‘’An actual pytest call like:pytest --boost_xml=reports --boost_xml_filename=campaign --boost_xml_report_title=my_projectwould produce reports like:reports
   |
   |---- campaign_Log.xml
   |
   |---- campaign_Summary.xml
   |
   |---- campaign.html
Package: pytest-bootstrap
Scientific software development often relies on stochasticity, e.g. forMonte Carlointegration or simulating theIsing model. Testing non-deterministic code is difficult. This package offers a bootstrap test to validate stochastic algorithms, including multiple hypothesis correction for vector statistics. It can be installed by runningpip install pytest-bootstrap.ExampleSuppose we want to implement the expected value oflog-normal distributionwith location parameter\muand scale parameter\sigma.>>>importnumpyasnp>>>>>>deflognormal_expectation(mu,sigma):...returnnp.exp(mu+sigma**2/2)>>>>>>deflognormal_expectation_wrong(mu,sigma):...returnnp.exp(mu+sigma**2)We can validate our implementation by simulating from a lognormal distribution and comparing with the bootstrapped mean.>>>frompytest_bootstrapimportbootstrap_test>>>>>>mu=-1>>>sigma=1>>>reference=lognormal_expectation(mu,sigma)>>>x=np.exp(np.random.normal(mu,sigma,1000))>>>result=bootstrap_test(x,np.mean,reference)This returns a summary of the test, such as the bootstrapped statistics.>>>result.keys()dict_keys(['alpha','alpha_corrected','reference','lower','upper','z_score','median','iqr','tol','statistics'])Comparing with our incorrect implementation reveals the bug.>>>reference_wrong=lognormal_expectation_wrong(mu,sigma)>>>result=bootstrap_test(x,np.mean,reference_wrong)Traceback(mostrecentcalllast):...pytest_bootstrap.BootstrapTestError:thereferencevalue1.0liesoutsidethe1-(alpha=0.01)interval...Visualising the bootstrapped distribution usingpytest_bootstrap.result_histcan help identify discrepancies between the bootstrapped statistics and the theoretical reference value. Note that you need to install matplotlib separately or install pytest-bootstrap usingpip install pytest-bootstrap[plot]... plot:: examples/lognormal.py
:caption: Histogram of bootstrapped means reveals the erroneous implementation of the log-normal mean.A comprehensive set of examples can be found inthe tests.Interface.. automodule:: pytest_bootstrap
:members:
Package: pytest-bpdb
Apytestplugin for dropping tobpdbon test failures.This plugin is almost entirely based on built-inpytest pdb pluginandpytest-ipdbpluginInstallationTo install the plugin run:pip install pytest-bpdbor use a development version:pip install -e git+git://github.com/slafs/pytest-bpdbUsageTo enable a BPython debugger (bpdb) on pytest failures use a--bpdboption.
For example:py.test --bpdb tests/
Package: pytest-bravado
Pytest-bravado automatically generates client fixtures from OpenAPI specification.Bravado documentation.InstallationTo install pytest-bravado via pip run the following command:pipinstallpytest-bravadoExample UsageSimple tests:importpytest@pytest.mark.parametrize('getUser',[{'id':1}],indirect=True)deftest_get_user(getUser):assertgetUser.result@pytest.mark.parametrize('createUser',[{'id':2,'username':'Ivan'}],indirect=True)deftest_create_user(createUser,getUser):assertgetUser(id=2).response().resultSupport openapi example:If there is an instance in the specifics, it will be used as the default request body.parameters:-in:"body"name:"body"schema:$ref:"#/definitions/User"example:id:10username:Olegimportpytestdeftest_create_user(createUser):assertcreateUser.response().resultrequest body:{'id':10,'username':'Oleg'}You can use mark parametrize to change all or part of the example.@pytest.mark.parametrize('createUser',[{'username':'Ivan'}],indirect=True)deftest_create_user(createUser):assertcreateUser.resultrequest body:{'id':10,'username':'Ivan'}Run:pytest--swagger_urlhttp://user-service.com/swagger.jsonSpec example:swagger:"2.0"info:version:"1.0.0"title:"Userservice"host:"user-service.com"schemes:-"http"paths:/user{id}:get:operationId:"getUser"parameters:-in:"path"name:"id"required:truetype:"integer"responses:default:description:"successful"schema:$ref:"#/definitions/User"/createUser:post:operationId:"createUser"produces:-"application/json"parameters:-in:"body"name:"body"schema:$ref:"#/definitions/User"example:id:10username:Olegresponses:default:description:"successful"definitions:User:type:"object"properties:id:type:"integer"username:type:"string"The following flags are supported–swagger_url- openapi spec url–request_headers- request headers–not_validate_responses- not validate incoming responses–not_validate_requests- not validate outgoing requests–not_validate_swagger_spec- not validate the swagger spec–not_use_models- not use models (Python classes) instead of dicts for #/definitions/{models}–enable_fallback_results- use fallback results even if they’re provided–response_metadata_class- What class to use for response metadata
Package: pytest-breed-adapter
pytest-breed-adapterA simple plugin generate json report and sent to breed server for report visualizationThispytest_ plugin was generated withCookiecutter_ along with@hackebrot'scookiecutter-pytest-plugintemplate.InstallationYou can install "pytest-breed-adapter" viapip_ fromPyPI_::$ pip install pytest-breed-adapterUsageFor full functionality you need buildbreed-serverwhich is close-source project
But you can build your own server for further usage, plugin will send json report to
breed server address +/report/parse[pytest]
addopts              = --breed
title                = what evever title you want /{or leave it empty}
json_report_file     = auto/ none/ arbitary.json
json_report_indent   = 4/ none
metadata             = true/ false
CI_server            = 192.168.1.199
breed_server         = http://192.168.1.199:62180test_demo():
    """
    @ Node id
    @! key0: value0
    @! key1: value1
    @! key2: value2
    @! key3: value3
    """
    assert 1first line of docstring startswith @spacewill be parsed to test nodeid
reset line with@!prefix will be treated as metadata key-valueContributingContributions are very welcomeLicenseDistributed under the terms of theBSD-3_ license, "pytest-breed-adapter" is free and open source softwareIssuesIf you encounter any problems, pleasefile an issue_ along with a detailed description.
Package: pytest_browserstack
Py.test plugin forBrowserStack.InstallationThe current stable release:pip install pytest_browserstackor:easy_install pytest_browserstackor from source:$ sudo python setup.py installPython supportpytest-browserstack supports Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, PyPy, PyPy3 and Jython.
Package: pytest-bug
pytest-bugPytestplugin for marking tests as a bugInstallationpipinstallpytest-bugExampleimportpytest@pytest.mark.bug("C18","Critical bug")# mark skip testdeftest_one():assertFalse@pytest.mark.bug("C39","Minor bug",run=True)# mark xfail test if fail else passdeftest_two():assertFalse@pytest.mark.bug("C41","Minor bug",run=True)deftest_three():assertTrue@pytest.mark.bug("Bug all tests")classTestFour:deftest_one(self):# mark skip testassertFalsedeftest_two(self):# mark skip testassertTrue@pytest.mark.bug("Unstable tests",run=True)classTestFive:deftest_one(self):# mark xfailassertFalsedeftest_two(self):# passassertTrue$pytest========================testsessionstarts========================platformlinux--Python3.x.y,pytest-x.y.z,py-x.y.z,pluggy-x.y.z
cachedir:$PYTHON_PREFIX/.pytest_cache
rootdir:$REGENDOC_TMPDIRplugins:bug-x.y.z
collected7items

test_sample.pybfpbbfp

----------Bugsskipped:3Bugspassed:2Bugsfailed:2----------===================2passed,5skippedin0.10s===================Symbols:b- bug skipf- bug failp- bug passverbosity$pytest-v========================testsessionstarts========================platformlinux--Python3.x.y,pytest-x.y.z,py-x.y.z,pluggy-x.y.z
cachedir:$PYTHON_PREFIX/.pytest_cache
rootdir:$REGENDOC_TMPDIRplugins:bug-x.y.z
collected7items

test_sample.py::test_oneBUG-SKIP[14%]test_sample.py::test_twoBUG-FAIL[28%]test_sample.py::test_threeBUG-PASS[42%]test_sample.py::TestFour::test_oneBUG-SKIP[57%]test_sample.py::TestFour::test_twoBUG-SKIP[71%]test_sample.py::TestFive::test_oneBUG-FAIL[85%]test_sample.py::TestFive::test_twoBUG-PASS[100%]----------Bugsskipped:3Bugspassed:2Bugsfailed:2----------===================2passed,5skippedin0.10s===================Options:optiondescriptionconfig--bug-no-statsDisabling summary statisticsbug_summary_stats (bool)--bug-pattern=REGEXRun matching tests marked as bug---bug-all-runIncludes all bugs in the run---bug-all-skipDisables all bugs in the run---bug-skip-letter=LETTERSet to output in console for skip-bug (default: b)bug_skip_letter (string)--bug-fail-letter=LETTERSet to output in console for fail-bug (default: f)bug_fail_letter (string)--bug-pass-letter=LETTERSet to output in console for pass-bug (default: p)bug_pass_letter (string)--bug-skip-word=WORLDSet to output in console for skip-bug verbosity (default: BUG-SKIP)bug_skip_word (string)--bug-fail-word=WORLDSet to output in console for fail-bug verbosity (default: BUG-FAIL)bug_fail_word (string)--bug-pass-word=WORLDSet to output in console for fail-bug verbosity (default: BUG-PASS)bug_pass_word (string)Contributions are very welcome.Getting startedpython 3.11pipenv 2022.12.19+Clone the repositorygitclonehttps://github.com/tolstislon/pytest-bug.gitcdpytest-bugInstall dev dependenciespipenvinstall--dev
pipenvshellRun the blackpipenvrunblackRun the testspipenvruntests
Package: pytest-bugzilla
py.test plugin to integrate it with bugzilla so that it’s possible to
annotate tests with the identifier of the bug they’re testing.If the bug has been closed but the test still fails, a warning is
generated and if the bug is still open, the test is flagged as
analysed (instead of Failed)UsageAfter installation (e.g. viapip installpytest-bugzilla) you can
just invokepy.test``withthe``--bugzillaflag.Usepy.test--helpfor additional options.Annotating testsTo mark a test as being for a specific issue (say issue no. 12345),
Put “#12345” somewhere in the test functions docstring e.g.:def test_something():
  "This test is for bug #12345"
  do_test()Bugzilla credentialsYou have to change the bugzilla server URL/username/password using
command line options. You can edit the plugin file to change the
defaults so that they work without having to pass these options
explicitly.