Saravanan666/pypi-org huggingface dataset:
Package: pytest-select
This is apytestplugin which allows to (de-)select tests by name from a list loaded from a file.InstallationIt’s recommended to install this package from PyPI:pip install pytest-selectUsageThis plugin adds new command line options to pytest:--select-from-file--deselect-from-file--select-fail-on-missingThe first two both expect an argument that resolves to a UTF-8 encoded text file containing one test name per
line.The third one changes the behaviour in case (de-)selected test names are missing from the to-be executed tests.
By default a warning is emitted and the remaining selected tests are executed as normal.
By using the--select-fail-on-missingflag this behaviour can be changed to instead abort execution in that case.Test names are expected in the same format as seen in the output ofpytest--collect-only--quietfor example.Both plain test names or complete node ids (e.g.test_file.py::test_name) are accepted.Example:$~ cat selection.txt
test_something
test_parametrized[1]
tests/test_foo.py::test_other

$~ pytest --select-from-file selection.txt
$~ pytest --deselect-from-file selection.txtDevelopmentThis package usesPoetry.
To setup a development environment install Poetry and then run:poetry installQuestionsWhy not use pytest’s builtin-koptionThe-kselection mechanism is (currently) unable to deal with selecting multiple parametrized
tests and is also a bit fragile since it matches more than just the test name.
Additionally, depending on the number of tests, giving test names on the command line can overflow
the maximum command length.What is this useful forThe author uses this plugin tosplit tests across workersonCircle CI.Example:pytest --collect-only --quiet | \
    grep '::' | \
    circleci tests split --split-by=timings --timings-type=testname > selected.txt
pytest --select-from-file selected.txtVersion Historyv0.1.2- 2019-01-18:Add informational pytest header report outputv0.1.1- 2018-12-10:Add--select-fail-on-missingoptionAdd basic mutation testingv0.1.0post0- 2018-12-08:Fix READMEv0.1.0- 2018-12-08:Initial release
Package: pytest-selenium-pdiff
# pytest-selenium-pdiff[![Current Version](https://img.shields.io/pypi/v/pytest-selenium-pdiff.svg)](https://pypi.python.org/pypi/pytest-selenium-pdiff)
[![Build Status](https://img.shields.io/circleci/project/rentlytics/pytest-selenium-pdiff.svg)](https://circleci.com/gh/rentlytics/pytest-selenium-pdiff)A pytest package implementing perceptualdiff for Selenium tests.Free software: MIT licenseDocumentation:https://pytest-selenium-pdiff.readthedocs.org.## Features
* Embeds screenshots in [pytest-html](https://pypi.python.org/pypi/pytest-html) reports
* Supports ImageMagick or perceptualdiff for image comparison.## Use with pytest-html and pytest-selenium
By default pytest-selenium will embed a screenshot depicting the current browser state.  This will lead to a duplicated screenshot because of this plugin’s behavior.  At this time the best way to exclude the pytest-selenium screenshot is to set the environment variableSELENIUM_EXCLUDE_DEBUG=screenshot.## Working With This Repo
### Setup
1. Set up and activate [virtual environment](http://docs.python-guide.org/en/latest/dev/virtualenvs/) in the repo by
running:virtualenv venvand thensource venv/bin/activate1. Runpip install -r requirements_dev.txt1. Install PhantomJS withbrew install phantomjs1. Runtoxto run the tests for the repo### Making a release
For Rentlytics employees, to release new code for the pytest-selenium-pdiff project to pypi, follow these steps:1. runbumpversionto bump the version
1. make sure there is a file in the home directory~/.pypircwith the login credentials for PyPi.  For more about
how to upload to PyPi, see [this link](http://peterdowns.com/posts/first-time-with-pypi.html)
1. runmake releaseto push the new code to PyPiHistory0.1.0 (2016-06-02)First release on PyPI.
Package: pytest-sequence-markers
Pytest Marker SequenceThis plugin helps you sequence your markers in pytest.We mark our tests with different markers, say like nightly, sanity, stress etc. If we wish to sequence these markers for execution of our tests, we can sequence them inpytest.iniitself as mentioned below.InstallationPlugin is available onpypi.orgaspipinstallable.Install by pip command aspipinstallpytest-sequence-markersEditingpytest.inipytest.iniis a configuration file forpytest.For sequencing the markers, add a section namedtest_execution_sequenceinpytest.iniAdd a key namedmarker_sequenceand mention the sequence of the markers you want.[pytest]markers=sanity: Sanity Testsnightly:Nightly Testsrelease:Release Testsnegative:Negative Tests[test_execution_sequence]marker_sequence=sanity, negative, nightly, releaseThe sequence of markers you specify comma separated in the ini file, tests will be executed in that sequence onlyExampleEdit thepytest.inias mentioned above and mention your own sequence with own markersAdd a test file containing allpytesttestsimportpytest@pytest.mark.sanitydeftest_sanity():pass@pytest.mark.releasedeftest_release():pass@pytest.mark.negativedeftest_negative():pass@pytest.mark.nightlydeftest_nightly():pass@pytest.mark.nightlydeftest_nightly2():passExecute the test with pytest command$pytest-sv==========================================================testsessionstarts==========================================================platformlinux--Python3.8.10,pytest-7.3.1,pluggy-1.0.0--/home/siddhesh/py38/bin/python
cachedir:.pytest_cache
rootdir:/home/siddhesh/plugin_test
configfile:pytest.ini
plugins:sequence-markers-0.0.1
collecting...Iaminlocalone
collected5itemstests/test_me.py::test_sanityPASSED
tests/test_me.py::test_negativePASSED
tests/test_me.py::test_nightlyPASSED
tests/test_me.py::test_nightly2PASSED
tests/test_me.py::test_releasePASSED==========================================================5passedin0.01s==========================================================
Package: pytest-serverless
pytest-serverlessAutomatically mocks resources defined in serverless.yml file usingmotoand uses them inpytest.This way you can focus on writing tests rather than defining enormous list of fixtures.masterPyPIPythonpytestLicence6.2Pre installation requirementsserverlessinstalledpytestinstalledInstallationpipinstallpytest-serverlessUsageAssuming yourserverless.ymlfile looks like:service:my-microserviceresources:Resources:TableA:Type:'AWS::DynamoDB::Table'DeletionPolicy:DeleteProperties:TableName:${self:service}.my-tableAttributeDefinitions:-AttributeName:idAttributeType:S-AttributeName:company_idAttributeType:SKeySchema:-AttributeName:idKeyType:HASHGlobalSecondaryIndexes:-IndexName:company_idKeySchema:-AttributeName:company_idKeyType:HASHProjection:ProjectionType:ALLProvisionedThroughput:ReadCapacityUnits:10WriteCapacityUnits:30ProvisionedThroughput:ReadCapacityUnits:10WriteCapacityUnits:30Just mark your test with@pytest.mark.usefixtures("serverless")andpytest-serverlesswill automatically createmy-microservice.my-tabledynamodb table.importboto3importpytest@pytest.mark.usefixtures("serverless")deftest():table=boto3.resource("dynamodb").Table("my-microservice.my-table")count_of_items=len(table.scan()["Items"])assertcount_of_items==0You can use a custom serverless file path setting the envionmnet variableSERVERLESS_FILE_PATH.$exportSERVERLESS_FILE_PATH=/path/to/serverless.ymlYou can use choose bothslsorserverlesscommand to run, settings the environment variableSERVERLESS_COMMAND. It will only accpetsslsorserverlessvalues.$exportSERVERLESS_COMMAND=slsSupported resourcesAWS::DynamoDB::TableAWS::SQS::QueueAWS::SNS::TopicAWS::S3::BucketAWS::KMS::Key
Package: pytest-servers
pytest serversFeaturesCreate temporary directories on the following filesystems:Local fsIn-memory fsS3, both using mock S3 remotes (https://github.com/spulec/moto) and real S3 remotesAzure, both using mock Azure remotes (https://github.com/Azure/Azurite) via docker and using real Azure Storage remotesGoogle Cloud Storage, both using mock GCS remote (https://github.com/fsouza/fake-gcs-server) via docker and using real Google Storage RemotesInstallationYou can installpytest serversviapipfromPyPI:$pipinstallpytest-serversTo use temporary S3 paths:$pipinstallpytest-servers[s3]To use temporary Azure paths$pipinstallpytest-servers[azure]To use temporary Google Cloud Storage paths$pipinstallpytest-servers[gcs]To install all extras:$pipinstallpytest-servers[all]UsageThe main fixture provided bypytest-serversprovides istmp_upath_factory, which can be used
to generate temporary paths on different (mocked) filesystems:deftest_something_on_s3(tmp_upath_factory):path=tmp_upath_factory.mktemp("s3")foo=path/"foo"foo.write_text("foo")...mktempsupports the following filesystem types:local(local filesystem)memory(in-memory filesystem)s3(Amazon S3)gcs(Google Cloud Storage)azure(Azure Storage)Some convenience fixtures that wraptmp_upath_factory.mktempand return a paths on these filesystems are also available:tmp_local_pathtmp_memory_pathtmp_s3_pathtmp_gcs_pathtmp_azure_pathThetmp_upathfixture can be used for parametrizing paths with pytest’s indirect parametrization:@pytest.mark.parametrize("tmp_upath",["local","s3","gcs"],indirect=True)deftest_something(tmp_upath):passIn order to use real remotes instead of mocked ones, usetmp_upath_factorywith the following methodstmp_upath_factory.s3(region_name, client_kwargs)where client_kwargs are passed to the underlying S3FileSystem/boto clienttmp_upath_factory.gcs(endpoint_url)tmp_upath_factory.azure(connection_string)Versioning support can be used by using theversioningfixture. This is currently supported for s3 and gcs remotes# using mktempdeftest_something_on_s3_versioned(tmp_upath_factory):path=tmp_upath_factory.mktemp("s3",version_aware=True)assertpath.fs.version_aware# bucket has versioning enabled# or, using remote-specific fixturesdeftest_something_on_s3_versioned(tmp_s3_path,versioning):asserttmp_s3_path.fs.version_aware# bucket has versioning enabledContributingContributions are very welcome.
To learn more, see theContributor Guide.LicenseDistributed under the terms of theApache 2.0 license,pytest serversis free and open source software.IssuesIf you encounter any problems,
pleasefile an issuealong with a detailed description.
Package: pytest-session2file
pytest-session2file is a py.test plugin that save failure or test session information to a file pass that can be
invoked as at command line when launching py.test run. It put in a file exactly what pytest return to stdout.InstallationInstall it with pip as follow :pip install pytest-session2fileUsageOnce the plugin is installed edit yourconftest.pyand insert in the top of the file :pytest_plugins = ‘pytest_session2file’Then you can launch your test with the new option–session2file=like this :py.test –session2file=FILENAMEIf you don’t want to edit yourconftest.pyyou can invoque py.test like this :py.test -p pytest_session2file –session2file=FILENAMEAt the end of the test execution you should obtain a text file with the content of stdout of py.test under the filename
provided that look like this :============== test session starts ====================…============== 2 passed in 34.70 seconds ==============NOTE:Name has change from pytest-session_to_file to pytest-session2fileTODO:Write testInspire by:_pytest.pastebinRef:https://github.com/pytest-dev/pytest/blob/master/_pytest/pastebin.pyPlatforms:AllVersion:0.1.11Date:2021-01-26 13:08:31License:LGPLv3 (http://www.gnu.org/licenses/lgpl.html)Copyright (C) 2015 Richard Vézina <ml.richard.vezinar@gmail.com>
Package: pytest-session-fixture-globalize
# pytest-session-fixture-globalizepytest-forcefail is a plugin to make scope=’session’ fixtures behave as if written in conftest.py.See test_session_fixture_globalize.py for example.Unlike usual plugin, this touches the deep area of _pytest.fixtures.FixtureManager.You have to enable this plugin explicitly by –session-fixture-globalize option or PYTEST_SESSION_FIXTURE_GLOBALIZE env.Binary distribution:https://pypi.org/project/pytest-session-fixture-globalize/
Package: pytest-session_to_file
pytest-session_to_file is a py.test plugin that save failure or test session information to a file pass that can be
invoked as at command line when launching py.test run. It put in a file exactly what pytest return to stdout.InstallationInstall it with pip as follow :pip install pytest-pytest_session_to_fileUsageOnce the plugin is installed edit yourconftest.pyand insert in the top of the file :pytest_plugins = ‘pytest_session_to_file’Then you can launch your test with the new option–session_to_file=like this :py.test –session_to_file=FILENAMEIf you don’t want to edit yourconftest.pyyou can invoque py.test like this :py.test -p pytest_session_to_file –session_to_file=FILENAMEAt the end of the test execution you should obtain a text file with the content of stdout of py.test under the filename
provided that look like this :============== test session starts ====================…============== 2 passed in 34.70 seconds ==============TODO:Write testInspire by:_pytest.pastebinRef:https://github.com/pytest-dev/pytest/blob/master/_pytest/pastebin.pyPlatforms:AllVersion:0.1.0Date:30 sept. 2015 11:25License:LGPLv3 (http://www.gnu.org/licenses/lgpl.html)Copyright (C) 2015 Richard Vézina <ml.richard.vezinar@gmail.com>
Package: pytest-setupinfo
pytest_setupinfoDisplaying setup info during pytest command runInstallation$pipinstallpytest_setupinfoUsageOnce pytest_setupinfo plugin is installed we can get setup related information using following command$ pytest -vs --setupinfothis plugin also have one method which returns pytest version/number fixtures/plugin which it supportedContributingInterested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.Licensepytest_setupinfowas created by Maheshwar Bolewar. It is licensed under the terms of the MIT license.Creditspytest_setupinfowas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.
Package: pytest-sftpserver
pytest-sftpserver is a plugin forpytestthat provides a local SFTP-Serverfixture.The SFTP-Server provided by this fixture serves content not from files but
directly from Python objects.QuickstartAssume you want to test a function that downloads a file from an SFTP-Server:fromcontextlibimportclosingimportparamikodefget_sftp_file(host,port,username,password,path):withclosing(paramiko.Transport((host,port)))astransport:transport.connect(username=username,password=password)withclosing(paramiko.SFTPClient.from_transport(transport))assftpclient:withsftpclient.open(path,"r")assftp_file:returnsftp_file.read()This plugin allows to test such functions without having to spin up an external
SFTP-Server by providing a pytestfixturecalledsftpserver. You use it
simply by adding a parameter namedsftpserverto your test function:deftest_sftp_fetch(sftpserver):withsftpserver.serve_content({'a_dir':{'somefile.txt':"File content"}}):assertget_sftp_file(sftpserver.host,sftpserver.port,"user","pw","/a_dir/somefile.txt")=="File content"As can be seen from this examplesftpserverserves content directly from
python objects instead of files.Installationpip install pytest-sftpserverSupported Python versionsThis package supports the following Python versions:2.7, 3.5 - 3.7TODOAdd more documentationAdd more usage examplesAdd TODOs :)Version History1.3.0 - 2019-09-16Updated supported Python versions to 2.7, 3.5 - 3.7.Droped (official) support for 3.4.Check / format code withblack,isortandflake8.Fix return type of.read(). (#15, thanks @WeatherGod)Support theoffsetparameter on write operations. (#11, #16, thanks @DrNecromant)1.2.0 - 2018-03-28Updated supported Python versions to 2.7, 3.4 - 3.6.
Droped (official) support for 2.6 and 3.2, 3.3.Now always uses posixpath internally to avoid problems when running on Windows (#7, #8, thanks @dundeemt)Fixed broken readme badges (#14, thanks @movermeyer)1.1.2 - 2015-06-01Fixed a bug in stat size calculation (#4)Fixed mkdir() overwriting existing content (#5)Thanks to @zerok for both bug reports and accompanying tests.1.1.1 - 2015-04-04Fixed brokenchmod()behaviour for non-existing ‘files’ (Thanks @dundeemt)1.1.0 - 2014-10-15Fixed brokenstat()behaviour for non-existing ‘files’Slightly increased test coverage1.0.2 - 2014-07-27Fixed broken test on Python 2.61.0.1 - 2014-07-27Added Python 3.2 supportCleaned up tox configuration1.0.0 - 2014-07-18Initial releaseLicenseLicensed unter the MIT License. See fileLICENSE.InspirationThe implementation and idea for this plugin is in part based upon:pytest-localserversftpserverTheTwisted Conch in 60 Secondsseries (although I ended up not using
twisted, this was very helpful understanding SFTP internals)
Package: pytest-shard
pytest-shardShards tests based on a hash of their test name enabling easy parallelism across machines, suitable for a wide variety of continuous integration services. Tests are split at the finest level of granularity, individual test cases, enabling parallelism even if all of your tests are in a single file (or even single parameterized test method).Featurespytest-shardaims for simplicity. When installed, simply run:$ pytest --shard-id=I --num-shards=NwhereIis the index of this shard andNthe total number of shards. For example, to split tests across two machines:# On machine 1:
$ pytest --shard-id=0 --num-shards=2
# On machine 2:
$ pytest --shard-id=1 --num-shards=2The intended use case is for continuous integration services that allow you to run jobs in parallel. For CircleCI, enableparallelismand then use:pytest --shard-id=${CIRCLE_NODE_INDEX} --num-shards=${CIRCLE_NODE_TOTAL}On Travis, you must define the environment variables explicitly, but can use asimilar approach.Alternativespytest-xdistallows you to parallelize tests across cores on a single machine, and can also schedule tests on a remote machine. I usepytest-shardto split tests across CI workers, andpytest-xdistto parallelize across CPU cores within each worker.pytest-sharddoes not take into account the run time of tests, which can lead to suboptimal allocations.pytest-circleci-parallelizeduses test run time, but can only split at the granularity of classes, and is specific to CircleCI.Please open a PR if there are other promising alternatives that I have overlooked.InstallationYou can installpytest-shardviapip:$ pip install pytest-shardContributionsContributions are welcome. Test may be run usingtox.LicenseThis software is MIT licensed.
Package: pytest-shell
A plugin for testing shell scripts and line-based processes with pytest.You could use it to test shell scripts, or other commands that can be run
through the shell that you want to test the usage of.Not especially feature-complete or even well-tested, but works for what I
wanted it for. If you use it please feel free to file bug reports or feature
requests.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesEasy access to a bash shell through a pytest fixture.Set and check environment variables through Python code.Automatically fail test on nonzero return codes by default.Helpers for running shell scripts.Mostly, all the great stuff pytest gives you with a few helpers to make it
work for bash.InstallationYou can install “pytest-shell” viapipfromPyPI:$ pip install pytest-shellUsageYou can use a fixture called ‘bash’ to get a shell process you can interact
with.Test a bash function:def test_something(bash):
    assert bash.run_function('test') == 'expected output'Set environment variables, run a .sh file and check results:def test_something(bash):
    with bash(envvars={'SOMEDIR': '/home/blah'}) as s:
        s.run_script('dostuff.sh', ['arg1', 'arg2'])
        assert s.path_exists('/home/blah/newdir')
        assert s.file_contents('/home/blah/newdir/test.txt') == 'test text'Run some inline script, check an environment variable was set:def test_something(bash):
    bash.run_script_inline(['touch /tmp/blah.txt', './another_script.sh'])
    assert bash.envvars.get('AVAR') == 'success'Use context manager to set environment variables:def test_something(bash):
    with bash(envvars={'BLAH2': 'something'}):
        assert bash.envvars['BLAH2'] == 'something'You can run things other than bash (ssh for example), but there aren’t specific
fixtures and the communication with the process is very bash-specific.Creating file and directory structurespytest_shell.fs.create_files() is a helper to assemble a structure of files and
directories. It is best used with the tmpdir pytest fixture so you don’t have
to clean up. It is used like so:structure = ['/a/directory',
             {'/a/directory/and/a/file.txt': {'content': 'blah'}},
             {'/a/directory/and': {'mode': 0o600}]
create_files(structure)which should create something like this:|
+ a
   \
    + directory
     \
      + and              # mode 600
       \
        + a
           \
            file.txt    # content equal to 'blah'TODOHelpers for piping, streaming.Fixtures and helpers for docker and ssh.Support for non-bash shells.Shell instance in setup for e.g. basepath.Refactoring TODOMake Connection class just handle bytes, move line-based stuff into an
intermediary.Make pattern stuff work line-based or on multiline streams (in a more
obvious way than just crafting the right regexes).Make pattern stuff work on part of line if desired, leaving the rest.LicenseDistributed under the terms of theMITlicense, “pytest-shell” is free and
open source software
Package: pytest-shell-utilities
What is Pytest Shell Utilities“When in doubt, shell out”—Thomas S. HatchThis pytest plugin was extracted frompytest-salt-factories.
If provides a basic fixtureshellwhich basically usessubprocess.Popento run commands against the running system on a shell while providing a nice
assert’able return class.InstallInstallingpytest-shell-utilitiesis as simple as:python-mpipinstallpytest-shell-utilitiesAnd, that’s honestly it.UsageOnce installed, you can now use theshellfixture to run some commands and assert against the
outcome.deftest_assert_good_exitcode(shell):ret=shell.run("exit","0")assertret.returncode==0deftest_assert_bad_exitcode(shell):ret=shell.run("exit","1")assertret.returncode==1If the command outputs parseable JSON, theshellfixture can attempt loading that output as
JSON which allows for asserting against the JSON loaded object.deftest_against_json_output(shell):d={"a":"a","b":"b"}ret=shell.run("echo",json.dumps(d))assertret.data==dAdditionally, the return object’s.stdoutand.stderrcan be line matched usingpytest.pytester.LineMatcher:MARY_HAD_A_LITTLE_LAMB="""\Mary had a little lamb,
Its fleece was white as snow;
And everywhere that Mary went
The lamb was sure to go.
"""deftest_matcher_attribute(shell):ret=shell.run("echo",MARY_HAD_A_LITTLE_LAMB)ret.stdout.matcher.fnmatch_lines_random(["*had a little*","Its fleece was white*","*Mary went","The lamb was sure to go.",])DocumentationThe full documentation can be seenhere.