Saravanan666/pypi-org huggingface dataset:
Package: pytest-bugzilla-notifier
This plugin currently has the following functionality:posts the results of test runs to be added to existing Bugzilla ticketscreate new tickets as part of a pytest testread bugs given a bug IDsearch for bugs given a searchInstallationYou can install “pytest-bugzilla-notifier” viapipfromPyPI:$ pip install pytest-bugzilla-notifierPre-requisitesTo use this plugin you need to have a username and password for a Bugzilla
account. First, you need to copy bugzilla.ini-dist to bugzilla.ini and add in
the BugZilla API key you will be using to access Bugzilla.Reporting test runsYou can use the plugin to update a ticket with the results by using the following command:$ pytest --bug=<bug ID> --config=./bugzilla.ini --bugzilla-url=<server> /path/to/tests<bug ID>
The ID that Bugzilla assigned to the bug you wish to have the test
results sent to.<server>
The full URL to the Bugzilla instance you wish to send test results to
(eghttps://bugzilla.mozilla.com)Creating new ticketsTo create a new ticket in Bugzilla, you need to import the library using:from pytest_bugzilla_notifier.bugzilla_rest_client import BugzillaRESTClientand then you can create bugs using code similar to this:api_details = {
    'bugzilla_host': '<bugzilla host you are using>',
    'bugzilla_api_key': '<bugzilla API key>'
}
rest_client = BugzillaRESTClient(api_details)
bug_data = {
    'product': 'Firefox',
    'component': 'Developer Tools',
    'summary': 'Test Bug',
    'version': 'unspecified'
}
bug_id = rest_client.bug_create(bug_data)If everything worked as expected,bug_idwill contain the ID BugZilla has assigned to your ticket.Reading Bug DetailsIf you know the ID for a bug, you can read in the details:api_details = {
    'bugzilla_host': '<bugzilla host you are using>',
    'bugzilla_api_key': '<bugzilla API key>'
}
rest_client = BugzillaRESTClient(api_details)
bug_id = <bug ID>
response = rest_client.bug_read(bug_id)Searching For BugsYou can follow the outlines forsearch parametersand then submit your search request:api_details = {
    'bugzilla_host': '<bugzilla host you are using>',
    'bugzilla_api_key': '<bugzilla API key>'
}
rest_client = BugzillaRESTClient(api_details)
search_details = {
    'product': 'Firefox',
    'component': 'Developer Tools',
    'summary': 'Test Bug',
}
bug_id = rest_client.bug_search(search_details)ContributingContributions are very welcome. Tests can be run withtox, please ensure
that the test suite passed before submitting a pull request.LicenseDistributed under the terms of theMozilla Public License 2.0license, “pytest-bugzilla-notifier” is free and open source software.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-buildkite
Note: This library was repurposed from tonybaloney’s pytest-azurepipelines,
the repurposing process is not yet complete.Plugin forpytestthat automatically publishes coverage and pytest reportannotationsto BuildKite.Just run pytest with this plugin and see your test results in the BuildKite UI!Features:Formats the PyTest output to show test docstrings and module names instead of just test case names in the Buildkite UI.Overloads the–junit-xmlflag on execution with a default valueUploads test results automatically, no need for a seperate test results upload commandDisplays the number of failed tests if there were failures as an error message in the UIAutomatically formats code coverage and uploads coverage data if pytest-cov is installedInstallationYou can install “pytest-buildkite” viapipfromPyPI:$ pip install pytest-buildkiteRunning in DockerThe plugin attempts to automatically detect if running inside a docker
container with path mounted in a different location, it will apply
the mappings to the path to report them back to Azure Pipelines using the path
from the host that has been bind mounted to the docker container. No
configuration is required it should just work as long as bind mounting is
used to the path the pytest output is written to. Also ensure the files are
written using an account the host has access to, this can be done by supplying
the user and group of the host account to the run command.dockerrun--user"$(id-u):$(id-g)"...ContributingContributions are very welcome.LicenseDistributed under the terms of theMITlicense, “pytest-buildkite” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.Additional DocumentationCode of ConductContribution Guidelines
Package: pytest-builtin-types
pytest-builtin-typespytest-builtin-types gives you prebuilt builtin data types for testing your own projects.Key Features:Basic Types: Has a selection of fixtures with pre-built types such asfloat,int,str, etc.Basic Containers: Has a selection of fixtures with pre-built containers such asdict,list,tupleetc.Great Developer Experience: Being fully typed makes it great for editor support.Installationpip install pytest-builtin-typesExampleBasic Typedeftest_float_type(float_1,float_2):print(float_1)# 1.1print(float_2)# 2.1Basic Typesdeftest_basic_types(basic_types_1,basic_types_2):print(basic_types_1)# {<class 'str'>: 'string1', <class 'int'>: 1, <class 'float'>: 1.1}print(basic_types_2)# {<class 'str'>: 'string2', <class 'int'>: 2, <class 'float'>: 1.2}Basic Containersdeftest_container_types(basic_containers_1):print(basic_containers_1)# {<class 'list'>: ['string1', 1, 1.1], <class 'tuple'>: ('string1', 1, 1.1), <class 'set'>: {1, 'string1', 1.1},# <class 'dict'>: {<class 'str'>: 'string1', <class 'int'>: 1, <class 'float'>: 1.1}}
Package: pytest-bwrap
Thispytestplugin allows running each test in its ownbubblewrapsandbox.This means each test runs in its own isolated environment, no test has any
side-effects on any other.Basic UsageJust install the plugin:$ pip install pytest-bwrapThen run your tests as usual, with a single added option:$ py.test --bwrapEach test will be run in its own sandbox.Sandbox detailsThe sandbox will have its own filesystem, layed out as follows:network access is blocked by default; (see “Options”)the following are mounted read-only from the host system:/etc/hostsand/etc/resolv.conf/usr(and the accompanying/bin,/lib,/sbin, with proper
handling of/usr-merge)the following are mounted from the host system:/dev/procthe current directory (that is, the root of the project you are testing)the active virtualenv, if running in one/tmpis a newtmpfs;OptionsNetwork AccessTests can optionally be granted network access, by decorating them withpytest_bwrap.decorators.network_enabled().Additional Read-only DirectoriesIt is sometimes useful to have read-only directories, for example when
verifying error handling in the tested functions.This can be achieved in one of two ways:decorating the test function withpytest_bwrap.decorators.read_only('/path/to/ro-dir');setting theextra-ro-dirsoption in thepytest configuration;ExampleA full example of how to use this plugin for testing is included.In particular, it shows how to use the decorators as well as the pytest
configuration.You should be able to switch to that directory, then run the tests:$ pip install -r requirements.txt
$ py.test --bwrapAll the tests should pass.LicenseThis project is offered under the terms of theGNU Lesser General Public License, either version 3 or any later version,
see theCOPYINGfile for details.0.1Initial release, with a basic feature-set to run each test in its own sandbox:host file system is mounted read-only, CWD is mounted read-write;network access is disabled by default but can be enabled for selected tests;additional directories can be made read-only;
Package: pytest-cagoule
pytest-cagouleis a pytest plugin to find which tests interact with the
code you’ve just changed.UsageCollect coverage information using--pytest-covcoverage contexts.py.test --cov --cov-context=testThen, to run the subset of tests that touch a particular file, usecagoule-select=<filename>[:linenumber], e.g.py.test --cagoule-select=path/to/file.pyIf you are usinggit, cagoule can find the files and lines that have changes
in the current working directory:py.test --diffor for any other diff spec that git can parse, using--diff=<spec>, e.g.py.test --diff=head~1..headYou probably want to configure your CI server to handle capturing.InstallingInstallpytest-cagouleusingpip:pip install pytest-cagouleCaveatsOnly lines executedduring individual test runsare captured. This often
excludes module level code, which is executed atimporttime, before the test
starts.  Also, tests are of course registered against the code as it was when
data was captured, so if using--diff, no new tests will be included.InspirationIdea fromnose-knowsLicenseMIT. SeeLICENSEfor details
Package: pytest-canonical-data
A plugin which allows to compare results with canonical results, based on previous runs.Inspired byYandex’s canondata plugin,pytest-needleandpytest-regtest.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.TODOImplement pytest’s hooks for assertsUse pytest’s asserts for comparing objectsDriver for imagesDriver for jsonHTML reports for imagesInstallationYou can install “pytest-canonical-data” viapipfromPyPI:$ pip install pytest-canonical-dataUsagePlugin providescanonical_datafixture, which allows to create canonical results:def test_sth(canonical_data):
    # creates canonical result object with name `result.txt` and `text` driver
    canonical_result = canonical_data('result.txt', 'text')
    # In default mode will compare saved canonical result with `123` string
    # In canonize mode will save `123` as the canonical result
    canonical_result.assert_equal('123')To run in canonize mode execute:pytest --canonizeIt will create files with canonical results (if don’t exist) and save actual results.DriversYou need to use appropriate driver for each data type. Currently, there are the following drivers:bytes: for comparing bytes sequences.str: for comparing python strings.text: alias for thestrdriver.ContributingContributions 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-canonical-data” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-caprng
A plugin that replays pRNG state on failure.Why is this?Testing stochastic functions is challenging. Crudely, one of two things happens:You learn to ignore sporadic failures.For example, if you constructed abinomial_testover some stochastic function, there is some probability it will fail. Knowing this, you rerun the test; it works; you conclude there is no problem. Usually, that is the correct conclusion. But, repeating this pattern over and over will blind you to genuinely faulty code. This makes bug discovery less likely. This is bad.You monkey patch your pRNG.Usually, this means scheduling realizations, injecting determinism. But, this requires knowing the implementation details of the function your testing. And, if that changes, the test needs a change, too. This is fragile. This makes bug discovery less likely. This is bad.This plugin is a compromise meant to eliminate (2) and reduce the prevalence of (1). It lendssomedegree of determinism to your tests by means of reproducibility.If your stochastic test fails, rerunning it will result in the exact same failure.How it works?Unless you have (cool) specialized hardware, your code doesn’t use random numbers. Instead, it uses a deterministic sequences of numbers produced by a Pseudo Random Number Generator (PRNG) that is “random enough.” Each PRNG has an internal state. When you draw a sample, the state changes. If you reset the PRNG’s state back to the original state, then sample again, the sample will be identical to the first one. It’s deterministic.This plugin exploits that determinism for the PRNGs underlyingrandomandnp.random. Prior to each test function, caprng [cap]tures the p[rng] state. If the test fails, the plugin writes the captured state to the cache. Then, when you rerun the tests, the plugin looks to see if your test function has any associated, cached PRNG state. If it does, it overwrites PRNG state topriorto running the test function,exactly reproducing the failing tests prior environment.InstallationYou can install “pytest-caprng” via:$ pip install pytest-caprngUsageForrandom-based state capturing:$ pytest --caprng-global-stdlibAnd fornp.random:$ pytest --caprng-global-npYou probably should add the option to your pytest.ini file:[pytest]
addopts = –caprng-global-stdlib –caprng-global-npso that you don’t “miss” reproducible errors.ContributingContributions 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 the MIT license, “pytest-caprng” is free and open source softwareIssuesIf you encounter any problems, please file an issue along with a detailed description.
Package: pytest-capture-warnings
pytest capture WarningsThis is a pytest plugin to collect and print a summary of all the warnings encountered during test execution and save them in a file.Installationpip install pytest-capture-warningsUsagepytest --output <output_file> <file_to_test>
or
CAPTURE_WARNINGS_OUTPUT=<output_file> pytest <files_to_test>Flake8 FormatThe output file is formatted on a flake8 format<filename/path>:<line number>:<character number>:<warning message>
Package: pytest-catch-server
Pytest Catch ServerPytestplugin with server fixture for catching HTTP requests.
It's handy for integration tests or for testing 3rd party packages which have
network side effects like reporting to 3rd party services (DataDog APM, Sentry, ...).InstallationYou can install "pytest-catch-server" viapip:pip install pytest-catch-serverUsageThis plugin comes with three fixtures. The maincatch_serveris for use in your tests:deftest_something(catch_server):url=f"http://{catch_server.host}:{catch_server.port}/something"requests.get(url)assertcatch_server.requests==[{"method":"GET","path":"/something","data":b""}]In more real world examples you may need to patch global module (like some tracer).It will flush list of catchedrequestsbetween each test.Catching these methods:GET,POST,PUT,PATCH,DELETEYou may want to setup your app fixture with catch server as dependency. You can
use session scoped fixturebackground_catch_serverfor that:@pytest.fixture(scope="session")defapp(background_catch_server):tracer_dsn=f"http://{background_catch_server.host}:{background_catch_server.port}"returncreate_app(tracer_dsn=tracer_dsn)deftest_tracing(app,catch_server):app.do_something_that_calls_tracer()assertcatch_server.requests==[{"method":"PUT","path":"/trace","data":b"..."}]Port for catch server is a random free port. If you want to use specific port, you
can overridecatch_server_portfixture in your tests which is returning free
port number.If you encounter any problems, pleasefile an issuealong
with a detailed description.ContributingContributions are very welcome. Tests can be run withtox, please ensure the coverage at
least stays the same before you submit a pull request.Pre-commithooks are set up for this project. Please
make sure you havepre-commitinstalled and set up on
this repo.LicenseDistributed under the terms of theMITlicense, "pytest-catch-server" is free and open source software.FootnoteThispytestplugin was generated withCookiecutteralong with@hackebrot'scookiecutter-pytest-plugintemplate.
Package: pytestcenter
Python OO API for Spirent TestCenter (STC).FunctionalityThe current version supports the following test flow:Load configuration -> Get/Set attributes -> Start/Stop traffic -> Get statistics.Build configuration -> Start/Stop traffic -> Get statistics.Supported operations:Basic operations - get/set attributes, get/create childrenConnect - to chassis or lab serverLoad configuration - load configuration (tcc or XML), reserve ports and analyze the configurationStart/Stop - arp, ping, devices, ports, streamsStatistics - subscribe, read views, unsubscribeSave configuration and resultsDisconnectLow level APIsStcRestWrapper - a Python wrapper over STC lab server REST API (using stcrestclient package).StcTclWrapper - a Python wrapper (using Python Tk package) over STC native Tcl API (SpirentTestCenter) .Installationpip install pytestcenterPrerequisiteLab/Rest server for REST API.TestCenter application installed for TclGetting startedUnder testcenter.test.stc_samples you will find some basic samples.
See inside for more info.Documentationhttp://pytestcenter.readthedocs.io/en/latest/ContactFeel free to contact me with any question or feature request atyoram@ignissoft.comChange LogChangeLog.md
Package: pytest-cfg-fetcher
pytest-cfg-fetcherUnit tests don't take arguments. Sometimes we like to pass an arg or two, e.g. you want to write test results to a file when running locally. This is a simple function to do that.pytest-cfg-fetcher assumes you have a directory called_test-config/in the same directory as your unit tests, e.g. undertest/. The_test-config/dir contains aconfig.jsonfile/_test-config/config.jsoncontians minimally:{
    "test_out_path": <path>
}which is a local path where you might want to write output for tests.Thefetch_config()function takes a single argument, which should be the name of the test that calls it -- the return value is a dict object containing the test_out_path and whatever else you want to pass into your unit tests.{
    "test_out_path": "test/_test-result",
    "my_test" {
        "my_test_bool_opt": true,
        "my_test_str_opt": "stringalingting"
    }
}Installationpip install pytest-cfg-fetcherUsage# mytest.pyfrompytest-cfg-fetcher.fetchimportfetch_configimportunittestclassTest(unittest.TestCase):deftest_import(self):config=fetch_config("my_test")...testystuf...test_result="results of test"ifconfigandconfig['my_test_bool_opt']:withopen(f"{config['test_out_path']}/{config['my_test_str_opt']}.txt","w+")asout:out.write(test_result)if__name__=='__main__':unittest.main()
Package: pytest-chalice
A set of py.test fixtures for AWS ChaliceFeaturesLaunch the local gateway per test functionProvide an abstracted client fixture to access the local gatewayExpose an interface to overwrite response context with arbitrary objectsAs of Chalice version 1.8.0, LocalGateway object doesn’t handle Cognito’s contextNot only for this purpose, it’s an interface provided to allow custom contexts in unit testsRequirementspytestChaliceInstallationYou can install “pytest-chalice” viapipfromPyPI:$ pip install pytest-chaliceUsagefromchaliceimportChaliceapp=Chalice(__name__)@app.route('/')defindex:return{'hello':'world'}pytest-chaliceexpects a fixture calledappwhich will be the chalice app instance from your project. You can create it in yourconftest.py:importpytestfromchaliceimportChalicefromproject.appimportappaschalice_app@pytest.fixturedefapp()->Chalice:returnchalice_appfromhttpimportHTTPStatusdeftest_index(client):response=client.get('/')assertresponse.status_code==HTTPStatus.OKassertresponse.json=={'hello':'world'}Seeexamplesfor more detailedContributingContributions 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-chalice” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-checkipdb
pytest-checkipdbPlugin to check if there are ipdb/pdb/breakpoint breakpoints left into our codeInstallationYou can install "pytest-checkipdb" viapipfromPyPI:$pipinstallpytest-checkipdbUsage$pytest--cipdbContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.Local developmentInstall all the python interpreters you need viapyenv. E.g.:$pyenvinstall3.5.3$pyenvinstall3.6.3$pyenvinstall3.7.7$pyenvinstall3.8.3and then make them global with:$pyenvglobal3.5.33.6.33.7.73.8.3Run the tests$toxLicenseDistributed under the terms of theMITlicense,pytest-checkipdbis free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.This is aPytestplugin was generated withCookiecutteralong with@hackebrot'sCookiecutter-pytest-plugintemplate.
Package: pytest-check-links
pytest-check-linkspytest plugin that checks URLs for HTML-containing files.Supported files.html.rst.md(TODO: select renderer).ipynb(requiresnbconvert)Installpip install pytest-check-linksUsepytest --check-links mynotebook.ipynbConfigure--links-extdefault:md,rst,html,ipynbA comma-separated list of extensions to check--check-anchorsAlso check whether links with#anchorsHTML files (either local, or with
served withhtmlin theContent-Type) actually exist, and point toexactly onenamed anchor.--check-links-ignoreA regular expression that matches URIs that should not be checked.
Can be specified multiple times for multiple ignore patterns.
This can be used for files that have a lot of links to GitHub pages,
such as a Changelog. GitHub has rate limiting, which would normally cause these files to take up to an hour to complete for larger repositories. For example:pytest --check-links --check-links-ignore "https://github.com/.*/pull/.*" CHANGELOG.mdCacheCaching requires the installation ofrequests-cache.pip install requests-cacheIf enabled, each occurrence of a link will be checked, no matter how many times
it appears in a collection of files to check.--check-links-cacheCache requests when checking links. Caching is disabled by default, and this option
must be provided, even if other cache configuration options are provided.--check-links-cache-namedefault:.pytest-check-links-cacheName of link cache, either the base name of a file or similar, depending on backend.--check-links-cache-backenddefault:sqlite3Cache persistence backend. The other known backends are:memoryredismongodbSee therequests-cache documentationfor more information.--check-links-cache-expire-afterdefault:None(unlimited)Time to cache link responses (seconds).--check-links-cache-backend-optBackend-specific options for link cache, provided askey:value. These are passed
directly to therequests_cache.CachedSessionconstructor, as they vary depending
on the backend.Values will be parsed as JSON first, so to overload the default of caching all
HTTP response codes (which requires a list ofints):--check-links-backend-optallowable_codes:[200]Code Stylingpytest-check-linkshas adopted automatic code formatting so you shouldn't
need to worry too much about your code style.
As long as your code is valid,
the pre-commit hook should take care of how it should look.
You can invoke the pre-commit hook by hand at any time with:pre-commitrunwhich should run any autoformatting on your code
and tell you about any errors it couldn't fix automatically.
You may also installblack integrationinto your text editor to format code automatically.If you have already committed files before setting up the pre-commit
hook withpre-commit install, you can fix everything up usingpre-commit run --all-files. You need to make the fixing commit
yourself after that.Some of the hooks only run on CI by default, but you can invoke them by
running with the--hook-stage manualargument.TODOpick a markdown renderer (probably commonmark) or make the markdown renderer pluggableoptions for validating links (allow absolute links, only remote or local, etc.)find URLs in Python docstrings