Saravanan666/pypi-org huggingface dataset:
Package: pytest-optional-tests
Provides easy declaration of optional tests using pytest markers.
Optional tests are run only on request via the config file or command
line.MotivationSome classes of tests should not be run with every test invocation.
It is often useful to define tests that be run only when specifically
requested, such as tests that are slow, require network access, or
work only in certain environments.Pytest provides mechanisms to run tests based on test names (-k) and
to filter tests based on markers (-m).  Neither mechanism makes it
easy to surpress certain tests by default.  For example, one might
decorate tests with@pytest.mark.network, but disabling it by
default requires a marker expression like-m “not network”with
every invocation.  Markers and marker expressions become unwieldy when
there are many markers.This plugin enables users to declare that certain markers are
“optional markers”.  When tests are decorated with an optional marker,
the test is skipped by default.  Tests may be decorated with multiple
markers, including multiple optional markers.  Optional tests may be
enabled in the pytest ini file or the command line.InstallationYou can install “pytest-optional-tests” viapipfromPyPI:$ pip install pytest-optional-testsUsageOptional markers must be declared in inicfg using the same syntax as
the markers option.  For example:[pytest]
optional_tests:
  slow: slow tests
  network: network tests
  bug: regression tests against previous bugsOptional markers should NOT be declared using themarkersattribute,
even when using pytest’sstrictmode.Optional test decorators are pytest markers, and the semantics are
identical.If a test is decorated with multiple optional markers, the test will
be executed when any of the markers is requested. For example:@pytest.mark.network
@pytest.mark.slow
def test_slow_network_function(): ...will be tested if either or both of the optionalslowornetworktests are requested.Optional tests may be requested in the inicfg:[pytest]
optional_tests:
  slow: slow tests
  network: network tests
  bug: regression tests against previous bugs
run_optional_tests=network,slowor on the command line:pytest --run-option-tests=network,slowContributingContributions 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.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.
Package: pytest-otel
pytest_otelFeaturespytest-otel plugin for reporting OpenTelemetry spans of tests executed.OpenTelemetryRequirementsopentelemetry-api == 1.15.0opentelemetry-exporter-otlp == 1.15.0opentelemetry-sdk == 1.15.0pytest >= 7.1.3InstallationYou can install "pytest-otel" viapipor using thesetup.pyscript.pipinstallpytest-otelUsagepytest_otelis configured by adding some parameters to the pytest command line. Below are the descriptions:--otel-endpoint: URL for the OpenTelemetry server. (Required). Env variable:OTEL_EXPORTER_OTLP_ENDPOINT--otel-headers: Additional headers to send (i.e.: key1=value1,key2=value2). Env variable:OTEL_EXPORTER_OTLP_HEADERS--otel-service-name: Name of the service. Env variable:OTEL_SERVICE_NAME--otel-session-name: Name for the main span.--otel-traceparent: Trace parent ID. Env variable:TRACEPARENT. Seehttps://www.w3.org/TR/trace-context-1/#trace-context-http-headers-format--otel-insecure: Disables TLS. Env variable:OTEL_EXPORTER_OTLP_INSECUREpytest--otel-endpointhttps://otelcollector.example.com:4317\--otel-headers"authorization=Bearer ASWDCcCRFfr"\--otel-service-namepytest_otel\--otel-session-name='My_Test_cases'\--otel-traceparent=00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01\--otel-insecure=FalseIMPORTANT: If you use--otel-headersthe transaction metadata might expose those arguments
with their values. In order to avoid any credentials to be exposed, it's recommended to use the environment variables.
For instance, given the above example, a similar one with environment variables can be seen below:OTEL_EXPORTER_OTLP_ENDPOINT=https://apm.example.com:8200\OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer ASWDCcCRFfr"\OTEL_SERVICE_NAME=pytest_otel\TRACEPARENT=00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01\OTEL_EXPORTER_OTLP_INSECURE=False\pytest--otel-session-name='My_Test_cases'DemosJaegerElastic StackLicenseDistributed under the terms of theApache License Version 2.0_ license, "pytest-otel" is free and open source software
Package: pytest-owner
pytest-owner为用例增加归属人owner标记，运行用例时可以使用--owner指定用例归属人运行。安装方法pipinstallpytest-owner使用方式# filename: test_pytest_owner.py@pytest.mark.owner('hzc')deftest_a():pass@pytest.mark.owner('superhin')deftest_b():pass使用以下命令指定归属人运行，支持指定多个归属人pytesttest_pytest_owner.py--owner=hzc--owner=superhin另外，该插件提供了额外的名为owner的Fixture函数，以共获取当前指定的owner列表。
Package: pytest-pact
A simple plugin to use with pytestThispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-pact” viapipfromPyPI:$ pip install pytest-pactUsageTODOContributingContributions 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-pact” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-pahrametahrize
pytest-pahrametahrizeParametrize your tests with a Boston accent!ExamplesimportpytestTRUTHINESS_TEST_CASES=[(None,False),(False,False),]@pytest.mark.parametrize(("in_val","truth_out"),TRUTHINESS_TEST_CASES)deftest_pahrametahrize(in_val,truth_out):assertbool(in_val)==truth_outbecomes:importpytestTRUTHINESS_TEST_CASES=[(None,False),(False,False),]@pytest.pahrametahrize(("in_val","truth_out"),TRUTHINESS_TEST_CASES)deftest_pahrametahrize(in_val,truth_out):assertbool(in_val)==truth_outWicked pissah.
Package: pytest-parallel
pytest-parallela pytest plugin for parallel and concurrent testingWhat?This plugin makes it possible to run tests quickly using multiprocessing (parallelism) and multithreading (concurrency).Why?pytest-xdistis great to run tests that:aren't threadsafeperform poorly when multithreadedneed state isolationpytest-parallelis better for some use cases (like Selenium tests) that:can be threadsafecan use non-blocking IO for http requests to make it performantmanage little or no state in the Python environmentPut simply,pytest-xdistdoes parallelism whilepytest-paralleldoes parallelism and concurrency.RequirementsPython3 version [3.6+]Unix or Mac for--workersUnix, Mac, or Windows for--tests-per-workerInstallationpip install pytest-parallelOptionsworkers(optional) - max workers (aka processes) to start. Can be apositive integer orautowhich uses one worker per core.Defaults to 1.tests-per-worker(optional) - max concurrent tests per worker. Can be apositive integer orautowhich evenly divides tests among the workers up to 50 concurrent tests.Defaults to 1.Examples# runs 2 workers with 1 test per worker at a timepytest--workers2# runs 4 workers (assuming a quad-core machine) with 1 test per workerpytest--workersauto# runs 1 worker with 4 tests at a timepytest--tests-per-worker4# runs 1 worker with up to 50 tests at a timepytest--tests-per-workerauto# runs 2 workers with up to 50 tests per workerpytest--workers2--tests-per-workerautoNoticeBeginning with Python 3.8, forking behavior is forced on macOS at the expense of safety.Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.SourceLicenseMIT
Package: pytest-parallel-39
pytest-parallela pytest plugin for parallel and concurrent testingWhat?This plugin makes it possible to run tests quickly using multiprocessing (parallelism) and multithreading (concurrency).Why?pytest-xdistis great to run tests that:aren't threadsafeperform poorly when multithreadedneed state isolationpytest-parallelis better for some use cases (like Selenium tests) that:can be threadsafecan use non-blocking IO for http requests to make it performantmanage little or no state in the Python environmentPut simply,pytest-xdistdoes parallelism whilepytest-paralleldoes parallelism and concurrency.RequirementsPython3 version [3.6+]Unix or Mac for--workersUnix, Mac, or Windows for--tests-per-workerInstallationpip install pytest-parallelOptionsworkers(optional) - max workers (aka processes) to start. Can be apositive integer orautowhich uses one worker per core.Defaults to 1.tests-per-worker(optional) - max concurrent tests per worker. Can be apositive integer orautowhich evenly divides tests among the workers up to 50 concurrent tests.Defaults to 1.Examples# runs 2 workers with 1 test per worker at a timepytest--workers2# runs 4 workers (assuming a quad-core machine) with 1 test per workerpytest--workersauto# runs 1 worker with 4 tests at a timepytest--tests-per-worker4# runs 1 worker with up to 50 tests at a timepytest--tests-per-workerauto# runs 2 workers with up to 50 tests per workerpytest--workers2--tests-per-workerautoNoticeBeginning with Python 3.8, forking behavior is forced on macOS at the expense of safety.Changed in version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes of the subprocess. See bpo-33725.SourceLicenseMIT
Package: pytest-param
pytest-param is a plugin forpy.testthat makes it
easy to test all, first, last or random params.RequirementsYou will need the following prerequisites to use pytest-param:Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, PyPy or PyPy3py.test 2.6 or newerInstallationTo install pytest-param:$pipinstallpytest-paramTesting a paramGiventest_file.pywith this test:importpytest@pytest.mark.parametrize("params",[True,False])deftest_param(params):passUse the--param=firstcommand line option to test theTrueparam:$py.test--param=firsttest_file.pyUse--param=lastto test theFalseparam:$py.test--param=lasttest_file.pyUse--param=randomto test one of the params at random.ResourcesRelease NotesIssue TrackerCode
Package: pytest-parametrization
pytest-parametrizationSimpler PyTest parametrizationHow to installpipinstallpytest-parametrizationHow to useExplicit parametersfromparametrizationimportParametrization@Parametrization.parameters("actual","expected")@Parametrization.case(name="some_case_0",actual=1,expected=2)@Parametrization.case("some_case_1",actual=1,expected=2)@Parametrization.case("some_case_2",1,expected=1)@Parametrization.case("some_case_3",2,2)@Parametrization.case("some_case_4",3,3)deftest_somthing(actual,expected):assertactual==expectedAuto-detect parametersfromparametrizationimportParametrization@Parametrization.autodetect_parameters()@Parametrization.case(name="some_case_0",actual=1,expected=2)@Parametrization.case("some_case_1",actual=1,expected=2)@Parametrization.case("some_case_2",actual=1,expected=1)deftest_somthing(actual,expected):assertactual==expectedAuto-detect parameters with default parameterfromparametrizationimportParametrization@Parametrization.autodetect_parameters()@Parametrization.default_parameters(expected=None)@Parametrization.case(name="some_case_0",actual=1,expected=2)@Parametrization.case("some_case_1",actual=1,expected=2)@Parametrization.case("some_case_2",actual=1,expected=1)@Parametrization.case("some_case_2",actual=1)deftest_somthing(actual,expected):assertactual==expectedGenerate name based on argumentsfromparametrizationimportParametrization@Parametrization.name_factory(lambdaactual,expected:'{}=={}'.format(actual,expected))@Parametrization.case(actual=1,expected=1)@Parametrization.case(actual=2,expected=2)@Parametrization.case('special-name',actual=3,expected=3)deftest_somthing(actual,expected):assertactual==expectedAs can be seen from the example, you can also give explicit name for a case
even if you are using name factory.
Package: pytest-parametrized
Pytestdecorator for parametrizing tests with default iterables, providing alternative syntax forpytest.mark.parametrize.UsageDecorate tests with iterable default values. Other fixtures can still be used as normal.functionsfromparametrizedimportparametrized@parametrizeddeftest(...,name=values):"""test single parametrized arg with each value"""@parametrized.zipdeftest(name=values,name1=values1,...):"""test parametrized args with zipped values"""@parametrized.productdeftest(name=values,name1=values1,...):"""test parametrized args with cartesian product of values"""Zip before and after example:@pytest.mark.parametrize("test_input,expected",[("3+5",8),("2+4",6),("6*9",42),])deftest_eval(test_input,expected):asserteval(test_input)==expected@parametrized.zipdeftest_eval(test_input=["3+5","2+4","6*9"],expected=[8,6,42]):asserteval(test_input)==expectedProduct before and after example:@pytest.mark.parametrize("x",[0,1])@pytest.mark.parametrize("y",[2,3])deftest_foo(x,y):pass@parametrized.productdeftest_foo(x=[0,1],y=[2,3]):passfixturesParametrized fixtureswhich simply return their param.fixture_name=parametrized.fixture(*params,**kwargs)Before and after example:@pytest.fixture(params=[0,1],ids=["spam","ham"])defa(request):returnrequest.parama=parametrized.fixture(0,1,ids=["spam","ham"])Installation%pipinstallpytest-parametrizedTests100% branch coverage.%pytest[--cov]
Package: pytest_param_files
pytest-param-filesA small package to generate parametrizedpytestsfrom external files.Simply create a text file with an available format:dotformat (default):[name1] description
.
input content
.
expected output content
.

[name2] description
.
input content
.
expected output content
.yamlformat:name1:description:optional descriptioninput:|-input contentexpected:|-expected output contentname2:description:optional descriptioninput:|-input contentexpected:|-expected output contentThen, use theparam_filepytest marker to create a parametrized test:frompathlibimportPathimportpytestimportmy_functionPATH=Path(__file__).parent.joinpath("test_file.txt")@pytest.mark.param_file(PATH,fmt="dot")deftest_function(file_params):assertmy_function(file_params.content)==file_params.expectedand the output will be:$pytest-vtest_file.py...test_file.py::test_function[1-name1] PASSEDtest_file.py::test_function[8-name2] FAILEDAlternatively use theassert_expectedmethod, which will can handle more rich assertion features:@pytest.mark.param_file(PATH,fmt="dot")deftest_function(file_params):actual=my_function(file_params.content)assertfile_params.assert_expected(actual,rstrip=True)$pytest-vtest_file.py...test_file.py::test_function[1-name1] PASSEDtest_file.py::test_function[8-name2] FAILED...E       AssertionError: Actual does not match expectedE       --- /path/to/test_file.txt:8E       +++ (actual)E       @@ -1 +1 @@E       -contentE       +otherInstallationInstall fromPyPI:$pipinstallpytest-param-filesor install locally (for development):$pipinstall-e.Regenerating expected output on failuresRunning pytest with the--regen-file-failureoption will regenerate the parameter file with actual output, if any test fails.Other formatsTODO ...
Package: pytest-parawtf
pytest-parawtfEver wondered howpytestdecides to spell parametrise?  Was it
parameterize?  Parametrise?  Parametrize?Confused yet?  Stop worrying, install this plugin and all variants are
valid:@pytest.mark.parametrize('a', [0, 1])
@pytest.mark.parameterize('b', [2, 3])
@pytest.mark.parametrise('c', [4, 5])
@pytest.mark.parametrise('d', [6, 7])
def test_wtf(a, b, c, d):
    assert a in [0, 1]
    assert b in [2, 3]
    assert c in [4, 5]
    assert d in [6, 7]But if you’ve ever parametrised a fixture, you may wonder why it’s yet
another spelling over there:@pytest.fixture(params=[0,1]).  Fear
not, you can now be consistent:@pytest.mark.params('a', [0, 1])
def test_simple(a):
    assert a in [0, 1]What about when you implement thepytest_generate_testshook in
yourconftest.pyfile?  We got you covered,metafunc.params()and the other (in)sane variations are now valid too.Monkey see, monkey doThis plugin monkeypatches the core pytest in ways which should never
be done.  In other words it voids all your warranties.  Use at your
own risk.Changelog1.0.2Actually stop using setup.py.Move to src/ layout, even for a single-module package.Include the tests in the sdist.1.0.1Fix REAME formatting and typos.Include the LICENSE file in the .tar.gz and .whl.Add pyproject.toml and move more things to setup.cfg.1.0.0Initial release.The MIT LicenseCopyright (C) 2017-2018 Floris BruynooghePermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Package: pytest-paste-config
pytest plugin to all passing the path to a paste config fileUsageinstall/update via:pip install -U pytest-paste-configand to run tests type:py.testRationaleThis plugin is written purely so that I can do:def test_connection(pytestconfig):engine = engine_from_config(pytestconfig.paste_file)
models.Base.metadata.create_all(engine)
# some test code…and then run:py.test –paste-file testing.ini
Package: pytest-patch
Pytest PatchAn automagic replacement formonkeypatchorunittest.mock.patchthat can be
used on objects either directly or by name.Usagepatching objects directlyfrom pytest import fixture
from mock import MagicMock, sentinel

from mymodule import callee, caller  # `caller` returns `callee()`


@fixture
def callee_mock(patch):
  # returns the second argument if provided, `MagicMock()` otherwise
  return patch(callee, MagicMock(return_value=sentinel.callee))


def test_caller(callee_mock):
  assert caller() == sentinel.calleepatching objects by name@fixture
def callee_mock(patch):
  return patch('callee')  # assumes `callee` is in `mymodule`patching by full pathThis behavior is similar tounittest.mock.patch.@fixture
def callee_mock(patch):
  return patch('mymodule.callee')ConfigurationBy default,pytest-patchassumes the following repository structure:mymodule/
  .git/
    ...
  mymodule/
    wat/
      ermelon.py
    ...
  tests/
    */  # e.g. unit/
      mymodule/
        wat/
          test_ermelon.py
    ...No configuration is needed if your repository matches this structure where the
repository name is the same as the name of the module and your tests are in
their corresponding subdirectories mirroring your module's path structure.If the above is not the case, e.g. you have a repository with a nonmatching
module name or a monorepo with multiple modules, you may specify the
corresponding flags either in thepytestcommand line or the ini file,
glob-style:pytest --module-names=mymodule,othermodule --test-paths=tests.unit,tests.e2e.*or (inpytest.ini)[pytest]
module_names = mymodule othermodule
test_paths = tests.unit tests.e2e.*
Package: pytest-pdb
pytest-pdbpy.test plugin pytest plugin which adds pdb helper commands related to pytest.Usageinstall via:pip install pytest-pdbCommandsgototest | gtWhen debugging with pdb, typegototestwhich brings you directly to
the frame of the test function.whichtest | wtWhen debugging with pdb, typewhichtestwhich should print something like:Currently in test_pdb.py:13: TestClasses.test_class_pdbIt works by walking the frame stack until it finds a test item in the locals.
This depends on howpytest_pyfunc_callis implemented.
If that changes or is replaced by a plugin, the whichtest command may fail.topMove to top (oldest) frame.bottomMove to bottom (newest) frame.Changes0.3.1 - 2018-07-31Remove debug print output.
[fschulze]0.3.0 - 2018-07-28Show offset of current frame to test frame.
[blueyed, fschulze]Addtopandbottomcommands.
[blueyed]Addwt/gtshortcuts.
[blueyed]Addgototestcommand.
[blueyed]Print location upon entering pdb.
[blueyed, fschulze]0.2.0 - 2017-01-17Fix/improve location reporting.
[blueyed (Daniel Hahler)]0.1.0 - 2016-07-09Initial release.
[fschulze (Florian Schulze)]
Package: pytest-peach
pytest-peach is a plugin forpy.testthat integrates withPeach API Security.  Integration includes calling the
correct Peach API Security APIs to report test names and not fuzzing setup and teardown requests.RequirementsYou will need the following prerequisites in order to use pytest-peach:Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 or PyPypy.test 2.8 or newerRequests v2.11 or newerInstallationTo install pytest-peach:$ pip install pytest-peachFrom Source$ python setup.py installUsageThe integration is intended to be run from CI integrations such as the
generic CI runner.
Several environmental variables are expected to have been set:PEACH_APIPEACH_API_TOKENPEACH_SESSIONIDPEACH_PROXY$ pytest –peach=on test_target.pyArguments–peach=onThis argument enables the pytest Peach API Security extention.
Package: pytest-pep257
PEP 257 plugin for py.test=============Minimal version of PEP 257 reports with py.testInstallation============Install with pip:::pip install pytest-pep257Usage============The files discovered by py.test will be checked with[https://pypi.python.org/pypi/pep257](pep257) by setting the flag `--pep257` as:::py.test --pep257
Package: pytest-perf
Run performance tests against the mainline code.UsageTo use it, include pytest-perf in the test dependencies for your project, then create some Python module in your package. The plugin will include any module that contains the text “pytest_perf” and will run performance tests on each function containing “perf” in the name.Tests don’t execute the module directly, but instead parse out the code of the function in two parts, the warmup and the test, separated by a “# end warmup” comment, and then passes those to thetimeitmodule.See theexercises.pymodule for example usage.Designpytest-perfworks by creating two installs, the control and the experiment, and measuring the performance of some python code against each.Under the hood, it usespip-runto install from the upstream main branch (e.g.https://github.com/jaraco/pytest-perf) for the control and from.for the experiment. It then runs each of the experiments against each of the enviroments.