Saravanan666/pypi-org huggingface dataset:
Package: pytest-meilisearch
pytest-meilisearchpytest helpers for testing Python projects using Meilisearch.InstallationUsing a virtual environment is recommended for installing this package. Once the virtual
environment is created and activated, install the package with:pipinstallpytest-meilisearchUsageNote that to use any of the async options you also need to install an async test helper such aspytest-asyncio.ConfigurationFlags--meilisearch-host: Host where the Meilisearch test server is running. For examplehttp://localhost. Default =http://127.0.0.1(This is the same ashttp://localhost).--meilisearch-port: Port where the Meilisearch test server is running. For example7700.
Default =7700.--meilisearch-master-key": The master key for the Meilisearch test server. Default =None.Settingsmeilisearch_client_scope: Modify the scope of the async_meilisearch_client and
meilisearch_client fixtures. Valid settings arefunction,module,package, orsession.
Default =function.meilisearch_clear: Controls if either documents or indexes are deleted after each tests. This
can be useful to ensure that tests don't interfer with each other. Valid options arenone= documents and indexes are not deleted,async_document= documents are asyncronously
deleted after each test,async_index= indexes are asyncronously deleted after each test,document= documents are syncronously deleted after each test, orindex= indexes are
syncronously deleted between each test. Default =none.ExamplesTesting that your function that adds documents to an index is successful:async:asyncdeftest_my_func(async_meilisearch_client):docs=[{"id":1,"title":"Ready Player One"},{"id":2,"title":"The Hitchhiker's Guide to the Galaxy"},]index_name="books"awaitmy_func(index_name,docs)index=async_meilisearch_client.index(index_name)result=awaitindex.get_documents()assertresult.results==docssync:deftest_my_func(meilisearch_client):docs=[{"id":1,"title":"Ready Player One"},{"id":2,"title":"The Hitchhiker's Guide to the Galaxy"},]index_name="books"my_func(index_name,docs)index=meilisearch_client.index(index_name)result=index.get_documents()assertresult.results==docsTesting that your search is successful:async:asyncdeftest_my_func(async_index_with_documents):docs=[{"id":1,"title":"Ready Player One"},{"id":2,"title":"The Hitchhiker's Guide to the Galaxy"},]index_name="books"index=awaitasync_index_with_documents(docs,index_name)results=awaitmy_func("Ready Player One")expected="Ready Player One"# Whatever you expect to be returnedassertresult==expectedsync:deftest_my_func(index_with_documents):docs=[{"id":1,"title":"Ready Player One"},{"id":2,"title":"The Hitchhiker's Guide to the Galaxy"},]index_name="books"index=index_with_documents(docs,index_name)results=my_func("Ready Player One")expected="Ready Player One"# Whatever you expect to be returnedassertresult==expectedContributingIf you are interested in contributing to this project please see ourcontributing guide.
Package: pytest-memlog
pytest-memlogContinuously logs the memory usage of your test session.Installationpipinstallpytest-memlogUsageUse--memlogto enable the plugin.By default, memory usage of a test run will be logged tomemlog.json.Options--memlog-path: The path to save the log to, defaults tomemlog.json.--memlog-interval: Measurement interval, defaults to 0.1 seconds.--memlog-warmup: Memlog will capture memory usage for this many secondsbeforestarting your tests. Defaults to 0.Markerslimit_memory(memory): Will mark a test as failed if the program memory exceeds this number during a test run.
Note that due to garbage collection, this does not necessarily reflect memory usage in a specific test.Implementationpytest-memlog uses a separate process to track the memory of the test process.
This allows for a very low overhead, as the only data passed between the processes
are test names & the maximum memory usage during a test.The memory logging is done at fixed intervals (given by--memlog-interval)
and saved to a JSON log.
Each log entry is of the following form:{"rss":40939520,"time":1814626.921,"name":"tests/test_basic.py::test_0"}rssis the used memory, in bytes.timeis the value fromtime.monotonic().
You'll probably want to normalize this when analyzing.nameis the name of the current running test, or an empty string between tests.AnalysisThe visualization at the top was generated using the data from our examples.You can see how in thesample notebookorview it live.To generate the log for the examples run:pytest--memlog./examples/Or use it on your own tests!
Package: pytest-memprof
Estimates memory consumption of test functionsThisPytestplugin was generated withCookiecutteralong with@hackebrot’sCookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-memprof” viapipfromPyPI:$ pip install pytest-memprofUsageTODOContributingContributions 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-memprof” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-message
Pytest-MessagePytest-message is a pytest extension for reporting to various messangers.Pytest-message gives an ability to send report message of test status for only marked tests.Installationpipinstallpytest-messageExampleCurrentlypytest-messageintegrates with slack only(other popular messengers integration in progress)In order to receive messages you need to define listener and pass list of listeners tonotifydecoratorfrompytest_message.listenersimportSlackListenerfrompytest_messageimportnotifyslack_listener=SlackListener(token="slack_secret_token",chat='chat_id')@notify([slack_listener])deftest_sum():assert1+1==2You may pass as much listeners as you want to get report messages to all listeners.SlackListenerSlackListener constructor takesrequired:token, chatandoptional:on_error_addfields.token- slack tokenchat- slack chat idon_error_add[Optional]- takes string which will be added after failed or skipped test function name in main thread.
Is nice for tagging responsible person if required or add any custom comment.LaunchIn order to start tests with Pytest-Message you must provide--notifyflag:pytesttests--notify
Package: pytest-messenger
pytest-messengerex pytest-slackPytest to IM reporting pluginSupported messengers and links to the usage:SlackDing TalkTelegram - soonRequirementsRequestsPython >= 3.6InstallationYou can install “pytest-messenger” viapip:$ pip install pytest-messengerIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.Credits[ ~ Dependencies scanned by PyUp.io ~ ]History1.0.1 (2019-04-18)First release on PyPI.2.1.2 (2020-02-10)Stable release.CreditsDevelopment LeadLaser,arseny.antonov@gmail.comContributorsrepsejnworblithammermstevensAWegnerGitHub
Package: pytest-mh
[!WARNING]
This plugin is still actively developed and even though it is mostly stable,
we reserve the right to introduce minor breaking changes if it is required for
new functionality.pytest_mh - pytest multihost test frameworkpytest-mhis a pytest plugin that, at a basic level, allows you to run shell
commands and scripts over SSH on remote Linux or Windows hosts. You use it to
execute system or application tests for your project on a remote host or hosts
(or containers) while running pytest locally keeping your local machine intact.The plugin also provides building blocks that can be used to setup and teardown
your tests, perform automatic clean up of all changes done on the remote host,
and build a flexible and unified high-level API to manipulate the hosts from
your tests.DocumentationSee the full documentation here:https://pytest-mh.readthedocs.io.Example usageThe following snippet was taken from theSSSDproject.@pytest.mark.topology(KnownTopology.AD)@pytest.mark.topology(KnownTopology.LDAP)@pytest.mark.topology(KnownTopology.IPA)@pytest.mark.topology(KnownTopology.Samba)deftest__id(client:Client,provider:GenericProvider):u=provider.user("tuser").add()provider.group("tgroup_1").add().add_member(u)provider.group("tgroup_2").add().add_member(u)client.sssd.start()result=client.tools.id("tuser")assertresultisnotNoneassertresult.user.name=="tuser"assertresult.memberof(["tgroup_1","tgroup_2"])
Package: pytest-mimesis
pytest-mimesispytest-mimesisis a pytest plugin that provides pytest fixtures forMimesisproviders. This allows you to quickly and easily use randomized, dummy data as part of your test suite.Installationpipinstallpytest-mimesisExamplesUsing the personal provider as part of a test.# your_module/__init__.pydefvalidate_email(email):# code that validates an e-mail addressreturnTrueAnd your test file:# tests/test_email.pyfromyour_moduleimportvalidate_emaildeftest_validate_email(mimesis):assertvalidate_email(mimesis('email'))You can also specify locales:@pytest.mark.parameterize('mimesis_locale',['de'])# use German localedeftest_create_user(mimesis):assertcreate_user(name=mimesis('full_name'))@pytest.mark.parameterize('mimesis_locale',['de','en','jp'])# test multiple localesdeftest_add_phone(user,mimesis):assertuser.add_phone_number(name=mimesis('full_name'))FixturesWe provide two public fixtures:mimesis_localeandmimesis.
Whilemimesis_localeis just a string (like:en,ru),mimesisis an instance ofmimesis.schema.Field.We use caching ofmimesisinstances for different locales for the whole
test session, so creating new instances is cheap.Related projectsYou might also be interested in:mimesisitself, it is awesome!mimesis-factorywhich bringsfactory_boyintegration tomimesisLicensepytest-mimesis is licensed under theMIT License.
Package: pytest-minecraft
pytest-minecraftA pytest plugin for running tests against Minecraft releases.The plugin automatically downloads the latest version of the Minecraft client into the pytest cache. The provided fixtures can also extract the vanillaresource packanddata packon demand.InstallationThe package can be installed withpip.$pipinstallpytest-minecraftUsageDownloading the Minecraft client takes a few seconds so the tests that use the fixtures provided by the plugin will be skipped unless explicitly enabled with a command-line flag. The--minecraft-latestflag will enable the tests and run them against the latest stable release.$pytest--minecraft-latestYou can also use the--minecraft-snapshotflag to test against the latest snapshot. Both flags can be specified at the same time to run the tests against both stable and snapshot releases.$pytest--minecraft-latest--minecraft-snapshotFixturesTheminecraft_client_jarfixture returns the path to the downloaded Minecraft client as apathlib.Pathinstance.deftest_with_client(minecraft_client_jar):assertminecraft_client_jar.name=="client.jar"withZipFile(minecraft_client_jar)asclient:assertlen(client.namelist())>10_000Theminecraft_resource_packfixture returns the path to the extracted vanilla resource pack as apathlib.Pathinstance.deftest_with_resource_pack(minecraft_resource_pack):assertminecraft_resource_pack.name=="resource_pack"assert(minecraft_resource_pack/"assets"/"minecraft"/"textures").is_dir()Theminecraft_data_packfixture returns the path to the extracted vanilla data pack as apathlib.Pathinstance.deftest_with_data_pack(minecraft_data_pack):assertminecraft_data_pack.name=="data_pack"assert(minecraft_data_pack/"data"/"minecraft"/"loot_tables").is_dir()ContributingContributions are welcome. This project usespoetry.$poetryinstallYou can run the tests withpoetry run pytest.$poetryrunpytestThe code follows theblackcode style.$poetryrunblack.License -MIT
Package: pytest-mini
pytest-mini微信小程序自动化测试pytest插件/工具基于MiniTest进行pytest改造使用方法准备测试小程序根据miniprogram-demo项目介绍运行一次项目成功运行后关闭安装&更新pipinstallpytest-mini--upgrade引入插件新建conftest.py文件frompytest_miniimportpluginspytest_plugins=plugins("待测试的小程序项目路径","微信开发者工具路径")例如demo/cases/conftest.pyfrompytest_miniimportpluginspytest_plugins=plugins("/Users/zhongxin/github/miniprogram-demo",# 待测试的小程序项目路径"/Applications/wechatwebdevtools.app/Contents/MacOS/cli"# 微信开发者工具路径)编写页面对象在demo/pages/components_page.py编写元素定位frompytest_miniimportMini,LocatorclassComponentsPage(Mini):view_container=Locator('view',inner_text='视图容器',desc='组件页-视图容器')在conftest.py中添加importpytestfrompages.components_pageimportComponentsPage@pytest.fixture(scope="session")defcomponents_page(mini):yieldComponentsPage(driver=mini.driver)编写测试代码demo/cases/test_home.pyimportallurefrompytest_miniimportcompose@compose(feature="小程序官方组件展示",story="组件",title='容器视图操作')deftest_view_container(components_page):withallure.step("点击容器视图"):components_page.click(components_page.view_container)assertFalse,"故意失败,查看报告截图"编写执行&报告展示脚本demo/cases/allure_debug.pyimportosimportpytestfrompytest_mini.constantimportConstanttest_cases=["test_home.py"]# 执行的脚本main_list=['-s','-v',*test_cases,'--durations=0','--clean-alluredir','--alluredir',f'{Constant().REPORT_PATH}/allure_results']pytest.main(main_list)ifnotos.getenv("BUILD_URL"):os.system(f"{Constant.ALLURE_TOOL}serve{Constant().REPORT_PATH}/allure_results")# 本地执行执行测试运行allure_debug.py文件查看报告
Package: pytest-minio-mock
pytest-minio-mockPip StatsOverviewpytest-minio-mockis a pytest plugin designed to simplify testing of applications that interact with Minio the code  S3 compatible object storage system. It is not designed to test the correnction to the minio server. It provides a fixture that mocks theminio.Minioclass, allowing for easy testing of Minio interactions without the need for a real Minio server.FeaturesMock implementation of theminio.Minioclient.Easy to use pytest fixture.Supports common Minio operations such as bucket creation, file upload/download, etc.InstallationTo installpytest-minio-mock, run:pipinstallpytest-minio-mockUsageTo use the minio_mock fixture in your pytest tests, simply include it as a parameter in your test functions. Then use minio.Minio() as usual Here's an example:deffoo():try:minio_client=minio.Minio(endpoint=S3_URI,access_key=S3_ACCESS_KEY,secret_key=S3_SECRET_KEY,region=S3_REGION)returnminio_client.make_bucket("buckets")exceptExceptionase:logging.error(e)deftest_file_upload(minio_mock):# Calling function foo that involves using minio.Minio()assertfoo()minio_client=minio.Minio(endpoint=S3_URI,access_key=S3_ACCESS_KEY,secret_key=S3_SECRET_KEY,region=S3_REGION)buckets=minio.list_buckets()assertlen(buckets)==1Theminio_mockfixture will patch newly created minio.Minio() thus providing you with a way to test your code around the Minio client easily.At the moment, instances of minio.Minio() created before loading the minio_mock fixture code will not be patched. This might be an issue if one or more of the fixtures you are using in your tests that preceedsminio_mockin the parameters list of the test function, initiates instances of minio.Minio() that you want to test. As a workaround make sure that minio_mock is the first fixture in the list of arguments of function where minio_mock is needed. Example:@pytest.fixture()defsystem_under_test(minio_mock:MockMinioClient,storage_provider_stub:StorageProvider):# your code herepassAPIMockMinioClientA brief description of the mocked methods and their behavior, like:make_bucket(bucket_name, ...)# Mocks bucket creation.fput_object(bucket_name, object_name, file_path, ...)# Mocks file upload....ContributingContributions to pytest-minio-mock are welcome! The Contributing Guide is still under construction.When creating a pull request make sure to use the following template:Change Summary
 - item one
 - item two
Related issue number
 - issue a
 - issue b
Checklist
  [ ] code is ready
  [ ] add tests
  [ ] all tests passing
  [ ] test coverage did not drop
  [ ] PR is ready for reviewLicensepytest-minio-mock is licensed under the MIT License - see the LICENSE file for details.
Package: pytest-missing-fixtures
Pytest plugin that creates missing fixturesThispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-missing-fixtures” viapipfromPyPI:$ pip install pytest-missing-fixturesUsageTODOContributingContributions 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-missing-fixtures” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-ml
Test your machine learning!Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-ml” viapipfromPyPI:$ pip install pytest-mlUsageTODOContributingContributions 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-ml” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-mocha
pytest-mochaPytest output inMochaJSformatIt uses docstrigs as a tool to create the sections that mocha creates using thedescribeanditstructure. Example:# file examples/test_example.pydeftest_case():'''Section :: subsection :: Should execute test'''passoutputs this:Section :: examples/test_example.py
    subsection
        ✓ Should execute testInstallpip install pytest-mochaUsepytest --mochaArgs--mocha: Enable mocha as pytest reporter--mocha-force-disable: Disable mocha reporter even if enabled with--mochaflag
Package: pytest-mock
This plugin provides amockerfixture which is a thin-wrapper around the patching API
provided by themock package:importosclassUnixFS:@staticmethoddefrm(filename):os.remove(filename)deftest_unix_fs(mocker):mocker.patch('os.remove')UnixFS.rm('file')os.remove.assert_called_once_with('file')Besides undoing the mocking automatically after the end of the test, it also provides other
nice utilities such asspyandstub, and uses pytest introspection when
comparing calls.Professionally supported pytest-mock is available.DocumentationFor full documentation, please seehttps://pytest-mock.readthedocs.io/en/latest.LicenseDistributed under the terms of theMITlicense.
Package: pytest-mock-api
A mock API server with configurable routes and responses available as a fixture.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-mock-api” viapipfromPyPI:$ pip install pytest-mock-apiUsageTODOContributingContributions 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-mock-api” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-mockito
Convenience plugin on top of mockito.Installpip installpytest-mockitoAfter that the plugin is enabled by default.FixturesThe plugin provides fixtures for the main entrypoints of mockito which guarantee that youunstub()on teardown. Usage isverysimple and straightforward:def test_foo(when):
    when(os.path).exists('/foo').thenReturn(False)
    assert os.path.exists('/foo')  # sic!
    # will still unstub/unpatch bc pytest will run the teardownFor convenienceverifyStubbedInvocationsAreUsedis called just beforeunstub. This should warn you when you setup stubs that you actually don’t use.You can also use a marker.usefixtureshere will ensure anunstubat the end of each test, but does not actually inject the fixture:import pytest

@pytest.mark.usefixtures('unstub')
class TestDog:
    def test(self):
        ...To markalltest cases at the module level:pytestmark = pytest.mark.usefixtures('unstub')All of the following fixtures just export the equivalent mockito function butunstub()on teardown. The exception here isexpectwhich also callsverifyNoUnwantedInteractions():when
when2
expect
patch
unstub
spy2
Package: pytest-mock-server
Mock server plugin for pytestInstallationYou can install “pytest-mock-server” viapipfromPyPI:$ pip install pytest-mock-serverUsageOne handlerimportpytestimportrequests@pytest.mark.server(url='/v1/books/',response=[{'id':1}],method='GET')deftest_handler_responses():response=requests.get('http://localhost:5000/v1/books/')assertresponse.status_code==200assertresponse.json()==[{'id':1}]More than one handlersimportpytestimportrequests@pytest.mark.server(url='/v1/books/',response=[{'id':1}],method='GET')@pytest.mark.server(url='/v1/books/<book_id>/',response={'id':1},method='GET')deftest_handler_responses():response=requests.get('http://localhost:5000/v1/books/')assertresponse.status_code==200assertresponse.json()==[{'id':1}]response=requests.get('http://localhost:5000/v1/books/1/')assertresponse.status_code==200assertresponse.json()=={'id':1}Callback executes before response returnsimportpytestimportrequestsimporttimedefsleep_two(*args,**kwargs):time.sleep(2)@pytest.mark.server(url='/v1/books/',response={},callback=sleep_two)deftest_handler_responses():"""Ensures Timeouts works"""withpytest.raises(requests.exceptions.Timeout):response=requests.get('http://localhost:5000/v1/books/',timeout=1)Custom settings for serverimportpytestimportrequests@pytest.mark.server(url='/v1/books/',response={})@pytest.mark.server_settings(port=8000)deftest_handler_responses():response=requests.get('http://localhost:8000/v1/books/')assertresponse.status_code==200assertresponse.json()=={}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-mock-server” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-mockservers
pytest-mockserverspytest-mockserverspackage provides a set of fixtures which can help you to test your code in cases when you need to check that requests which you sent to HTTP/UDP server are really sent.Available fixtures:http_serverhttp_server_factoryunused_portunused_port_factoryunused_udp_portunused_udp_port_factoryudp_server_factoryInstallation$pipinstallpytest-mockserversUsageLook intotests/*to find real examples ofpytest-mockserversfixtures usage.ContributingTo work on thepytest-mockserverscodebase, you'll want to clone the project locally and install the required dependencies viapoetry:$gitclonegit@github.com:Gr1N/pytest-mockservers.git
$makeinstallTo run tests and linters use command below:$makelint&&maketestIf you want to run only tests or linters you can explicitly specify which test environment you want to run, e.g.:$makelint-blackLicensepytest-mockserversis licensed under the MIT license. See the license file for details.
Package: pytest-modified-env
pytest-modified-envPytest plugin to fail a test if it leaves modifiedos.environafterwards.Example:importosdeftest_that_modifies_env()->None:os.environ['CUSTOM_ENV']='1'Withpytest-modified-envplugin installed, this test will fail:___________________________ test_that_modifies_env ____________________________
test_that_modifies_env:4: in pytest_runtest_call
E   RuntimeError: os.environ was changedBecause it addsCUSTOM_ENVinside a test and does not clean it up.
In theory it can affect other tests and tests should be isolated!Installationpipinstallpytest-modified-envExtrasIn some cases test still might modify the env in this way.
But, it needs an explicit approval for that:importosimportpytest@pytest.mark.modify_env()deftest_that_modifies_env()->None:os.environ['CUSTOM_ENV']='1'This test won't fail, eventhough it addsCUSTOM_ENV,
because it hasmodifies_envmarker.LicenseMIT