Saravanan666/pypi-org huggingface dataset:
Package: pytest-socket
pytest-socketA plugin to use with Pytest to disable or restrictsocketcalls during
tests to ensure network calls are prevented.FeaturesDisables all network calls flowing through Python'ssocketinterface.RequirementsPytest6.2.5 or greaterInstallationYou can installpytest-socketviapipfromPyPI:pip install pytest-socketor add to yourpyproject.tomlforpoetry:[tool.poetry.dev-dependencies]pytest-socket="*"UsageRunpytest --disable-socket, tests should fail on any access tosocketor
libraries using socket with aSocketBlockedError.To add this flag as the default behavior, add this section to yourpytest.ini:[pytest]addopts=--disable-socketor add this to yoursetup.cfg:[tool:pytest]addopts=--disable-socketor update yourconftest.pyto include:frompytest_socketimportdisable_socketdefpytest_runtest_setup():disable_socket()If you exceptionally want to enable socket for one particular execution
pass--force-enable-socket. It takes precedence over--disable-socket.To enable Unix sockets during the test run (e.g. for async), add this option:[pytest]addopts=--disable-socket --allow-unix-socketTo enable specific tests use ofsocket, pass in the fixture to the test or
use a marker:deftest_explicitly_enable_socket(socket_enabled):assertsocket.socket(socket.AF_INET,socket.SOCK_STREAM)@pytest.mark.enable_socketdeftest_explicitly_enable_socket_with_mark():assertsocket.socket(socket.AF_INET,socket.SOCK_STREAM)To allow only specific hosts per-test:@pytest.mark.allow_hosts(['127.0.0.1'])deftest_explicitly_enable_socket_with_mark():assertsocket.socket.connect(('127.0.0.1',80))or for whole test run[pytest]addopts=--allow-hosts=127.0.0.1,127.0.1.1Frequently Asked QuestionsQ: Why is network access disabled in some of my tests but not others?A: pytest's default fixture scope is "function", whichsocket_enableduses.
If you create another fixture that creates a socket usage that has a "higher"
instantiation order, such as at the module/class/session, then the higher order
fixture will be resolved first, and won't be disabled during the tests.
Read more inthis excellent exampleand more aboutpytest fixture order here.This behavior may change in the future, as we learn more about pytest
fixture order, and what users expect to happen.ContributingContributions are very welcome. Tests can be run withpytest, please ensure the
coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense, "pytest-socket" is
free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.ReferencesThisPytestplugin was generated withCookiecutteralong with@hackebrot'sCookiecutter-pytest-plugintemplate.This plugin came about due to the efforts by@hangtwentysolving aStackOverflow
question, then converted into a
pytest plugin by@miketheman.
Package: pytest-sofaepione
pytest_sofaepioneSetupChoose a package name and replace the template namepytest_sofaepionein all files:./quick-start.shMyPackageName
rmquick-start.sh# you can delete this file afterwardsUpload to pypipipinstall--upgradepip
pipinstallwheeltwinePlace yourpypi tokenin$HOME/.pypirc:[pypi]
  username = __token__
  password = # either a user-scoped token or a project-scoped token you want to set as the defaultTo upload to pypi,makeInstallpipinstallpytest_sofaepione
pipinstall-e<path-to-repo>/pytest_sofaepione
pipinstallgit+ssh://git@github.com/<path-to-repo>.git
Package: pytest-solr
Solr process and client fixtures for py.test.Introductionpytest-solr is a pytest plugin for the Apache Solr search server.
It provides three pytest factories:solr_process:For starting and stopping the Solr server. This is session scoped.solr_core:For loading and unloading a Solr core configuration. This is module scoped.solr:For connecting to a Solr server during a test. This is function scoped.Solr ProcessThe solr_process factory starts and stops a the Solr process.
An existing Solr executable is required for this.‘executable’:path to the Solr executable. Default value is ‘downloads/solr-<SOLR_VERSION>/bin/solr’‘host’:hostname where Solr runs. Default value is ‘localhost’.‘port’:port Solr uses. Default is value is ‘18983’.‘core’:Solr core that is used. Default value is ‘solr’.‘timeout’:timeout to wait for Solr to start. Default value is ‘60’ (seconds).Example:from pytest_solr.factories import solr_process

solr_process = solr_process(
  executable='solr-6.5.0/bin/solr',
  host='localhost',
  port=8983,
  core='default',
  version='6.5.0',
  timeout=60
)Solr CoreThe solr_core factory adds and removes a Solr core configuration.
It expects two parameters, the Solr Process fixture name and the Solr core name.‘solr_process_fixture_name’:String with the name of the Solr Process. This is a required parameter.‘solr_core_name’:String with the name of the Solr core. Default value is ‘default’.Example:from pytest_solr.factories import solr_core

my_solr_core = solr_core('solr_process', 'my_solr_core')SolrThe Solr factory connects to Solr via pysolr.
It expects a single parameter, the Solr core fixture name.‘solr_core_fixture_name’:String with the name of the Solr core. This is a required parameter.Example:# -*- coding: utf-8 -*-
from pytest_solr.factories import solr_core
from pytest_solr.factories import solr

minimal = solr_core('solr_process', 'minimal')
solr = solr('minimal')

def test_exact_term_match(solr):
    solr.add([{'id': '1', 'title': 'bananas'}])
    assert 1 == solr.search('title:bananas').hitsThe solr fixture can then be injected into the test function and used to add documents to solr or search for terms.See thepysolr documentation. for more details.InstallationInstall pytest-solr with pip:$ pip install pytest-solrUsageCreate a solr core with the name ‘minimal’ and inject the use the solr factory into a test function to use it:# -*- coding: utf-8 -*-
from pytest_solr.factories import solr_core
from pytest_solr.factories import solr

minimal = solr_core('solr_process', 'minimal')
solr = solr('minimal')


def test_exact_term_match(solr):
    solr.add([{'id': '1', 'title': 'bananas'}])
    assert 1 == solr.search('title:bananas').hitsLicenseCopyright kitconcept GmbH.Distributed under the terms of the MIT license, pytest-solr is free and Open Source software.ContributeSource code at GithubIssue tracker at GithubSupportIf you are having issues,please let us know. If you require professional support feel free to contact us atinfo@kitconcept.com.1.0.0 (2020-05-11)Set Solr to always_commit=True.
[timo]Black.
[timo]Make Solr 7.7.3 the new default.
[timo]1.0a1 (2017-06-22)Initial release.
[timo]
Package: pytest-sort
Pytest-SortThis pytest plugin is used to help identify application state leaks in your test suite.  It does this by automatically changing the execution order of test cases.How frustrating is it to have a test case that works fine when runs by itself, but fails when run with the rest of the suite?  By running tests in a random order, the culprit of such problems can be identified much earlier in the development process.  Alternately, running in ordered and reverse order can help find the cause of the problem in existing test suites.FeaturesMultiple sort options including: Random, Fastest, Reverse, and more.Group test cases into buckets that are each sorted separately.Control sort order of the buckets.Use Pytest markers to always run specific test cases in order.Quick StartInstallation:pip install pytest-sort --upgradeRunning with pytest-sort:pytest --sort-mode=randomDocumentation:Usage, Examples, Configuration, and more:https://pytest-sort.readthedocs.io/ContributeIssue Tracker:https://github.com/WiredNerd/pytest-sort/issuesSource Code:https://github.com/WiredNerd/pytest-sortSupportIf you are having issues, please let us know.I can be contacted at:pbuschmail-pytestsort@yahoo.comOr by opening an issue:https://github.com/WiredNerd/pytest-sort/issuesLicenseThe project is licensed under the MIT license.
Package: pytest-sorter
=============
pytest-sorter.. image::http://img.shields.io/pypi/v/pytest-sorter.svg:target:https://pypi.python.org/pypi/pytest-sorter.. image::https://travis-ci.org/AndreMicheletti/pytest-sorter.svg?branch=master:target:https://travis-ci.org/AndreMicheletti/pytest-sorter:alt: See Build Status on Travis CIA simple plugin to first execute tests that historically failed moreThispytest_ plugin was generated withcookiecutter_ along with@hackebrot'scookiecutter-pytest-plugintemplate.DescriptionThis plugin will save a history of your tests executions in a file.test_history. For each test it will
have how many times it was executed, and how many times it failed.Using that information it will calculate the percentage of failure of tests, and order them
to first execute the higherfailure ratioRequirementsPython>=3InstallationYou can install "pytest-sorter" viapip_ fromPyPI_::$ pip install pytest-sorterUsageAfter installed, your tests will automatically create and update the.test_historyfile,
and order tests by their failure ratio.You can tell pytest to ignore this plugin by passing:pytest --no-sortedContributingContributions 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 theMIT_ license, "pytest-sorter" is free and open source softwareIssuesIf you encounter any problems, pleasefile an issue_ along with a detailed description... _Cookiecutter:https://github.com/audreyr/cookiecutter.. _@hackebrot:https://github.com/hackebrot.. _MIT:http://opensource.org/licenses/MIT.. _BSD-3:http://opensource.org/licenses/BSD-3-Clause.. _GNU GPL v3.0:http://www.gnu.org/licenses/gpl-3.0.txt.. _Apache Software License 2.0:http://www.apache.org/licenses/LICENSE-2.0.. _cookiecutter-pytest-plugin:https://github.com/pytest-dev/cookiecutter-pytest-plugin.. _file an issue:https://github.com/AndreMicheletti/pytest-sorter/issues.. _pytest:https://github.com/pytest-dev/pytest.. _tox:https://tox.readthedocs.io/en/latest/.. _pip:https://pypi.python.org/pypi/pip/.. _PyPI:https://pypi.python.org/pypi
Package: pytest-sosu
Pytest-SosuPytest-Sosu (pronounced Sōsu, ソース) is an unofficial Pytest plugin for running tests
on Sauce Labs platforms.InstallationYou can install pytest-sosu latest version via pip:pip install pytest-sosuBasic UsageAssuming you haveSAUCE_USERNAMEandSAUCE_ACCESS_KEYenvironment variables set
(credentials can be obtainedhere),
you can write a simple test:deftest_visit(sosu_selenium_webdriver):driver=sosu_selenium_webdriverdriver.get("http://example.com/")assertdriver.title=="Example Domain"Examplesfrompytest_sosu.webdriverimportCapabilitiesMatrix,Browser# running given test on multiple browsers@pytest.mark.sosu(capabilities_matrix=CapabilitiesMatrix(browsers=[Browser("chrome"),Browser("firefox")],),)deftest_visit_many_browsers(driver):driver.get("http://example.com/")assertdriver.title=="Example Domain"# when build basename is set, tests running in given pytest session# have a build assigned@pytest.fixture(scope="session")defsosu_build_basename():return'my-project-name'# alias for sosu_selenium_webdriver@pytest.fixturedefdriver(sosu_selenium_webdriver):yieldsosu_selenium_webdriver
Package: pytest-sourceorder
A pytest plugin for ensuring tests within a class are run in source order.DownloadingRelease tarballs will be made available for download from Pagure Releases:https://pagure.io/releases/python-pytest-sourceorder/You can also install using pip:https://pypi.python.org/pypi/pytest-sourceorderThe plugin is also available in Fedora repositories aspython3-pytest-sourceorder.UsageWhen installed, test classes marked@pytest_sourceorder.orderedwill
have tests tun in the order of their definition.Methods are ordered by line nuber of their definition, so spreading them
between multiple files or otherwise defining them outside of their class
might cause the plugin to order them wrong.When inheriting from an ordered test class, the superclass’ methods will be
run first (even if overridden), followed by the ones from subclasses.
You generally donotwant to apply an additional@ordereddecorator
to the subclasses – doing so will reset the inheritance-based ordering.ContributingThe project is happy to accept patches!
Please file any patches as Pull Requests on the project’sPagure repo.
Any development discussion should be in Pagure Pull Requests and Issues.Developer linksBug tracker:https://pagure.io/python-pytest-sourceorder/issuesCode browser:https://pagure.io/python-pytest-sourceorder/tree/mastergit clonehttps://pagure.io/python-pytest-sourceorder.gitUnstable packages for Fedora:https://copr.fedoraproject.org/coprs/pviktori/pytest-plugins/To release, update version in setup.py, add a Git tag like “v0.3”,
and runmake tarball.
Runningmake uploadwill put the tarball to Fedora Hosted and PyPI,
and a SRPM on Fedorapeople, if you have the rights.
Runningmake releasewill upload and fire a COPR build.Changelogv0.6 (2021-09-01)Added support for decorated methods
(thanks to Sergey Orlov)v0.5.1 (2017-04-11)Packaging improvements onlyv0.5 (2016-01-26)Added support for parametrized tests under Python 3v0.4 (2015-01-26)Python 3 compatibility
Package: pytest-spark
pytestplugin to run the tests with support of pyspark (Apache Spark).This plugin will allow to specify SPARK_HOME directory inpytest.iniand thus to make “pyspark” importable in your tests which are executed
by pytest.You can also define “spark_options” inpytest.inito customize pyspark,
including “spark.jars.packages” option which allows to load external
libraries (e.g. “com.databricks:spark-xml”).pytest-spark provides session scope fixturesspark_contextandspark_sessionwhich can be used in your tests.Note:no need to define SPARK_HOME if you’ve installed pyspark using
pip (e.g.pip install pyspark) - it should be already importable. In
this case just don’t define SPARK_HOME neither in pytest
(pytest.ini / –spark_home) nor as environment variable.Install$pipinstallpytest-sparkUsageSet Spark locationTo run tests with required spark_home location you need to define it by
using one of the following methods:Specify command line option “–spark_home”:$ pytest --spark_home=/opt/sparkAdd “spark_home” value topytest.iniin your project directory:[pytest]
spark_home = /opt/sparkSet the “SPARK_HOME” environment variable.pytest-spark will try to importpysparkfrom provided location.Note“spark_home” will be read in the specified order. i.e. you can
overridepytest.inivalue by command line option.Customize spark_optionsJust define “spark_options” in yourpytest.ini, e.g.:[pytest]
spark_home = /opt/spark
spark_options =
    spark.app.name: my-pytest-spark-tests
    spark.executor.instances: 1
    spark.jars.packages: com.databricks:spark-xml_2.12:0.5.0Using thespark_contextfixtureUse fixturespark_contextin your tests as a regular pyspark fixture.
SparkContext instance will be created once and reused for the whole test
session.Example:def test_my_case(spark_context):
    test_rdd = spark_context.parallelize([1, 2, 3, 4])
    # ...Using thespark_sessionfixture (Spark 2.0 and above)Use fixturespark_sessionin your tests as a regular pyspark fixture.
A SparkSession instance with Hive support enabled will be created once and reused for the whole test
session.Example:def test_spark_session_dataframe(spark_session):
    test_df = spark_session.createDataFrame([[1,3],[2,4]], "a: int, b: int")
    # ...Overriding default parameters of thespark_sessionfixtureBy defaultspark_sessionwill be loaded with the following configurations :Example:{
    'spark.app.name': 'pytest-spark',
    'spark.default.parallelism': 1,
    'spark.dynamicAllocation.enabled': 'false',
    'spark.executor.cores': 1,
    'spark.executor.instances': 1,
    'spark.io.compression.codec': 'lz4',
    'spark.rdd.compress': 'false',
    'spark.sql.shuffle.partitions': 1,
    'spark.shuffle.compress': 'false',
    'spark.sql.catalogImplementation': 'hive',
}You can override some of these parameters in yourpytest.ini.
For example, removing Hive Support for the spark session :Example:[pytest]
spark_home = /opt/spark
spark_options =
    spark.sql.catalogImplementation: in-memoryDevelopmentTestsRun tests locally:$ docker-compose up --build
Package: pytest-spec
pytest-specLibrary pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.Available featuresFormat output to look like specification.Group tests by classes and filesFailed, passed and skipped are marked and colored.Remove test_ and underscores for every test.It is possible to use docstring summary instead of test name.Supports function based, class based test.Supports describe like tests.Output exampleConfigurationspec_header_formatYou can configure the format of the test headers by specifying aformat stringin yourini-file:[tool:pytest]spec_header_format={module_path}:In addition to the{path}and{class_name}replacement fields, there is also{test_case}that holds a more human readable name.spec_test_formatYou can configure the format of the test results by specifying aformat stringin yourini-file:3 variables are available:result - place for indicatorname - name of testdocstring_summary - first line from test docstring if available[tool:pytest]spec_test_format={result} {name}or[tool:pytest]spec_test_format={result} {docstring_summary}In second example where docstring is not available the name will be added to spec output.spec_success_indicatorYou can configure the indicator displayed when test passed.[tool:pytest]spec_success_indicator=✓spec_failure_indicatorYou can configure the indicator displated when test failed.[tool:pytest]spec_failure_indicator=✗spec_skipped_indicatorYou can configure the indicator displated when test is skipped.[tool:pytest]spec_skipped_indicator=?spec_ignoreComma-separated settings to ignore/hide some tests or output from from plugins like FLAKE8 or ISORT.
Any test which contain provided string will be ignored in output spec.[tool:pytest]spec_ignore=FLAKE8spec_indent[tool:pytest]spec_indent="   "Continuous IntegrationDownloadAll versions of library are available on officialpypi server.Installpipinstallpytest-specContributionPlease feel free to present your idea by code example (pull request) or reported issues.Contributors@0x64746b@lucasmarshall@amcgregor@jhermann@frenzymadness@chrischambers@maxalbert@jayvdbLicensepytest-spec - pytest plugin to display test execution output like a SPECIFICATION.Copyright (C) 2014-2021 Pawel ChomickiThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Package: pytest-spec2md
pytest-spec2mdThis project is an add-on to pytest. It generates a markdown files as specification, while running the tests.This project is inspired bypytest-specandpytest-honors.Getting startedInstall the module using pip.pip install pytest-spec2mdThen you can activate the module using--spec2mdParameter when calling pytest.
You should set--spec2md-versionto embed this value in the final document.You find the generated markdown files underdocsfolder, if not changed in config.ConfigurationYou can change the target directory using the parameterspec_target_file.[pytest]test_spec_target_file=path/to/target/test/spec/filespec_source_file=path/to/source/spec/filespec_target_file=path/to/target/spec/with/test/fileUsing markersThe plugin provides the markerfunc_reference. This marker can be used to connect a test_case with the testing object.
The name of testing object will than be added to the documentation. If an optional documentation is provided, this will
also be displayed.The marker can be used at every layer of testing object, so you can also use it at a class.Furthermore, it provides the markerspec_identifier. This identifier can be used, to connect tests with the identifier
in the specification document.Additionally, there is the markertest_type. This can be used to define the type of the test to be displayed in the
specification document. The default displayed is UnitTest. The module provides an enum with some default types to use,
own types can be used as well.Exampleimportpytestfrompytest_spec2mdimportTestTypedeffunction_to_ref():""" Simple doc commentwith two lines"""pass@pytest.mark.func_reference(function_to_ref.__name__,function_to_ref.__doc__)deftest_use_a_reference_in_doc():assertTrue@pytest.mark.spec_identifier('Spec.FuntionA')deftest_uses_identifier_from_spec():assertTrue@pytest.mark.spec_identifier('Spec.FuntionA')@pytest.mark.test_type(TestType.PERFORMANCE)deftest_this_is_a_performance_test():assertTrueThis is how the identifier should be used on a specification file.# Specification FileHere you find more information for the requirement.

<!-- TestRef: Spec.FuntionA -->As a result, a block is added at each position of the comment<!-- TestRef: add_reference_here -->.
Therefore, the comment has to be a single line.
After this comment the information about the referenced tests are added.ExamplesExamples for the usage can be found here:UseCases on GitHub
Package: pytest-sphinx
A doctest plugin for pytest, which understands the sphinx-specific
directives fromdoctest-sphinx. Those sphinx-specific directives can be
used in rst files as well as in docstrings of python modules.Featuressupport for thedoctestdirectivesupport fortestcodeandtestoutputdirectivessupport fortestsetupandtestcleanupis planned (pull-requests welcome)support for parsing global optionflags (doctest_optionflags) frompytest.inisupport for:options:intestoutputsupport for:skipif:intestcodeand intestoutput:hide:is ignored by “pytest-sphinx”RequirementspytestInstallationYou can install “pytest-sphinx” viapipfromPyPI:$ pip install pytest-sphinxUsageSeedoctest-sphinx. Have a look at the examples indoctest-examples.Run pytest with the–doctest-modulesflag.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 theBSD-3license, “pytest-sphinx” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-splitio
Split.io SDK integration for e2e testsRequirementsPytest >= 5.0splitio_client >= 8.0InstallationYou can install “pytest-splitio” viapipfromPyPI:$ pip install pytest-splitioUsageThere are two types of markers -skipif_split_not_equalandskipif_split_equals.This test will be skipped if ‘cool-split-name’ split’s value is not equal to “on” value in environmentimportpytest@pytest.mark.skipif_split_not_equal('cool-split-name','on')deftest_m1():passThis test will be skipped if ‘cool-split-name’ split’s value is equal to “off” valueimportpytest@pytest.mark.skipif_split_equals('cool-split-name','off')deftest_m2():passYou can also add some logic inside your test, by checking split’s treatment valueMake sure to pass ‘split’ argument to your test functiondeftest_m3(split):split_treatment=split.get_treatment('cool-split-name')ifsplit_treatment=='on':print('YES!!!')Now to Run your tests you need to specify –SPLIT-KEY argument or create an environment variableSPLIT_KEY,
which should be environment SDK key:$ python -m pytest --SPLIT-KEY="your-split-sdk-key"ContributingContributions are very welcome.LicenseDistributed under the terms of theMITlicense, “pytest-splitio” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.