Saravanan666/pypi-org huggingface dataset:
Package: pytest-testrail-integrator
Pytest Testrail Integrator.Pytest-testrail-integrator is a pytest extension for reporting test results toTestrail.Pytest-testrail-integrator gives an ability to send test results to specific testrail run or can create new one during
test execution. Fully compatible withxdistparallelization tool.Installationpipinstallpytest-testrail-integratorExampleIn order to link pytest test to testrail case you need to mark test withpytest.mark.caseortr_casedecorator with testcase id passing as argument.importpytestfrompytest_testrail_integrator.clientimporttr_case@pytest.mark.case('98765')# Use raw pytest marker.deftest_sum():assert1+1==2@tr_case('987654')# Use custom decorator.deftest_divide():assert2/1==2Test case id must not start with "C" char and can be either string or integer.Main flow overview.At startup plugin checks if the Testrail run id is passed or not. If not passed - plugin will create new test run by
itself. Then during tests execution testrail tests will be updated in real time.Config for TestRailAll required configs can be loaded from virtual environment variables(higher priority)
:TR_RUN_ID
TR_API_URL
TR_USER_EMAIL
TR_USER_PASSWORD
TR_PROJECT_ID
TR_SUTE_IDOrAdd options topytest.inifile.LaunchIn order to start tests with Pytest-Message you must provide--tr-reportingflag:pytesttests--tr-reportingAll available command line options.optiondescription--tr-reportingCreate and update testruns with TestRail--tr-deselect-testsIf pass testrun id only. Selects only tests which have been marked with case decorator with appropriate case id. Other tests are marked as deselected and not started in test execution.All available pytest.ini options.optiondescriptiontr_api_urlTestrail api url.tr_run_idTestrail test run id. If passed test reports are linked to this particular test run.tr_user_emailTestrail User email for API authentication.tr_user_passwordTestrail User password for API authentication.tr_project_idTestrail Project Id. Required for new test run creation if Test Run Id is not passed.tr_suite_idTestrail Suite Id. Required for new test run creation if Test Run Id is not passed.tr_tbTraceback level in testrail message reports. ['short', 'long'] options. Short is selected by default.Hookspytest_tr_generate_run_name(config: pytest.Config) - > str:Executes for generating new testrail run name right before create test run request is sent. Takes first hook result.pytest_tr_generate_run_description(config) - > str:Executes for generating new testrail run description right before create test run request is sent. Takes first hook result.
Package: pytest-testrail-plugin
pytest-testrail-pluginPyTest plugin for integration with TestRailUsageInstalling
pip install pytest-testrail-pluginCreate config file .cfgtest/testrail_config.cfg:[API]
url = https://cashwagon.testrail.io
email = name@cashwagon.com
password = pass

[TESTRUN]
project_id = your ID
root_section = directory_nameUse@pytestrail.case()decorator for testsfrom pytest_testrail_plugin.plugin import pytestrailUse docstring inyamlorjsonformat if you want customize test casefrompytest_testrail_plugin.pluginimportpytestrail@pytestrail.case()deftest_foo():"""title: case title in TestRailcustom_preconds: preconditions infocustom_steps: steps infocustom_expected: this is too long a stringto print in a single line"""assert1==1Run test with flagspy.test --testrail --tr-config=path/to/config/file.cfgIf you want to delete unused cases and sections use--tr-unsafeflag:py.test --testrail --tr-config=path/to/config/file.cfg --tr-unsafe
Package: pytest-testreport
pytest-testreport1、pytest-testreport介绍pytest-testreport是一个针对pytest的生成html报告的插件，使用起来非常简单，安装好pytest-testreport之后，运行用例时加上参数即可生成报告注意点：如果安装了pytest-html这个插件，请先卸载，不然会有冲突使用案例：命令行执行： pytest 运行测试时加上参数--report 指定报告文件名# 指定报告文件名pytest--report=musen.html#其他配置参数--title=指定报告标题
--tester=指定报告中的测试者
--desc=指定报告中的项目描述# 同时使用多个参数pytest--report=musen.html--title=测试报告--tester=测试菜鸟--desc=项目描述pytest.main执行importpytest

pytest.main(['--report=musen.html','--title=测试报告标题','--tester=木森','--desc=报告描述信息'])2、安装pytest-testreportpytest-testreport是基于python3.6开发的，安装前请确认你的python版本>3.6安装命令pip install pytest-testreport3、使用文档：https://unittestreport.readthedocs.io/en/latest/doc9_pytest/备注：开发者：柠檬班—木森、柠檬班—雨泽E-mail:musen_nmb@qq.com大家在使用过程中发现bug,可以联系我，以便优化解决！
Package: pytest-testreport-new
pytest-testreport1、pytest-testreport介绍pytest-testreport-new是一个针对pytest的生成html报告的插件，基于开源工具pytest-testreport的修改，使用起来非常简单，安装好pytest-testreport-new之后，运行用例时加上参数即可生成报告注意点：如果安装了pytest-html这个插件，请先卸载，不然会有冲突使用案例：命令行执行： pytest 运行测试时加上参数--report 指定报告文件名# 指定报告文件名pytest--report=report.html#其他配置参数--title=指定报告标题
--tester=指定报告中的测试者
--desc=指定报告中的项目描述# 同时使用多个参数pytest--report=report.html--title=测试报告--tester=测试菜鸟--desc=项目描述pytest.main执行importpytest

pytest.main(['--report=musen.html','--title=测试报告标题','--tester=tester','--desc=报告描述信息'])2、安装pytest-testreportpytest-testreport是基于python3.6开发的，安装前请确认你的python版本>3.6安装命令pip install pytest-testreport-new
Package: pytest-testslide
TestSlidefixture for pytest.QuickstartInstall:pip install pytest-testslideIn your test file:import pytest
        from pytest_testslide import testslide
        from testslide import StrictMock # if you wish to use StrictMock
        from testslide import matchers # if you wish to use Rspec style argument matchers
        .....
        def test_mock_callable_patching_works(testslide):
            testslide.mock_callable(time, "sleep").to_raise(RuntimeError("Mocked!")) #mock_callable
            with pytest.raises(RuntimeError):
                time.sleep()

        @pytest.mark.asyncio
        async def test_mock_async_callable_patching_works(testslide):
            testslide.mock_async_callable(sample_module.ParentTarget, "async_static_method").to_raise(RuntimeError("Mocked!")) #mock_async_callable
            with pytest.raises(RuntimeError):
                await sample_module.ParentTarget.async_static_method("a", "b")

        def test_mock_constructor_patching_works(testslide):
            testslide.mock_constructor(sample_module, "ParentTarget").to_raise(RuntimeError("Mocked!"))  #mock_constructor
            with pytest.raises(RuntimeError):
                sample_module.ParentTarget()

        def test_patch_attribute_patching_works(testslide):
            testslide.patch_attribute(sample_module.SomeClass, "attribute", "patched") #patch_attribute
            assert sample_module.SomeClass.attribute == "patched"
Package: pytest-test-this
Plugin forpytestto run relevant tests by naively check if test functions contain a reference to the symbol supplied.Limitations:it only looks for top level test functions, so test classes won’t be discoveredvery naive check, so indirect usages of a symbol won’t be foundThis trade off has been made for speed. This method is extremely fast compared to the other common method which tries to be correct by running the full test suite under coverage and checking if the function was called directly or indirectly.Installationpip install pytest-test-thisUsagepytest –test-this=foo…where foo is the name of your function, class or variable. You can write multiple symbols comma separated.There is also a special simplified mode for users of git:pytest –test-this-gitthis will try to automatically guess the symbols to run againsts based on agit diffand run pytest-test-this againsts those symbols
Package: pytest-tesults
Tesults plugin for pytestDescriptionTesults is the new standard in automated test results consolidation, reporting, analysis, failure tracking, manual test reporting and test case management.Use pytest-tesults to automatically integrate with Tesults.For complete details visit:https://www.tesults.com/docs/pytestRequirementsThe Tesults Python library is required. Install using pip from PyPI:$ pip install tesultsInstallationInstall pytest-tesults using pip from PyPI:$ pip install pytest-tesultsUsageVisithttps://www.tesults.com/docs/pytestfor documentation.LicenseDistributed under the terms of the MIT license, “pytest-tesults” is free and open source softwareIssuesIf you encounter any problems, please contacthelp@tesults.comor visithttps://www.tesults.com/contact
Package: pytest-textual-snapshot
pytest-textual-snapshotSnapshot testing for Textual apps.InstallationInstall usingpip:pip install pytest-textual-snapshotAfter installing, thesnap_comparefixture will automatically be made available.AboutApytest-textual-snapshottest saves an SVG screenshot of a running Textual app to disk.
The next time the test runs, it takes another screenshot and compares it to the saved one.
If the new screenshot differs from the old one, the test fails.
This is a convenient way to quickly and automatically detect visual regressions in your applications.UsageRunning testsYou can run your tests usingpytestas normal.My snapshot test failed, what do I do?If your snapshot test fails, it means that the screenshot taken during the test session
differs from the last screenshot taken.
This change is shown in the failure report, which you'll be given a linked to in the event of a failure.If the diff shown in the failure report looks correct, you can update the snapshot on disk
by runningpytestwith the--snapshot-updateflag.Writing testsBasic usageInject thesnap_comparefixture into your test and call
it with the path to the Textual app (the file containing theAppsubclass).deftest_something(snap_compare):assertsnap_compare("path/to/app.py")Pressing keysKey presses can be simulated before the screenshot is taken.deftest_something(snap_compare):assertsnap_compare("path/to/app.py",press=["tab","left","a"])
Package: pytest-tezos
Py.test plugin which adds a tezos fixture to encapsulate boilerplate business
logic. Refer totest_pytest_tezos.pyfor example usage.Install with pip, ie:pip install pytest-tezosRun an auto baking sandbox on localhost:docker run -p 8732:8732 yourlabs/tezosFor CI configuration, refer to.gitlab-ci.yml.
Package: pytest-th2-bdd
Th2 pytest bdd pluginThis is the plugin for pytest, which uses pytest-bdd plugin and th2 as backend.FeaturesTyped tables in feature file;Th2 client boilerplate isolation (auto th2 access factory creation, events hierarchy creation in background);Test context.InstallationFrom PyPIThis package can be found onPyPI.pip install pytest-th2-bddFrom Sourcegit clone https://github.com/th2-net/pytest-th2-bdd
pip install pytest-th2-bdd/Available fixturesfactoryThis fixture yields th2 CommonFactory for which will be created from configuration located inconfigs/directory.ctxThis fixture is used for inter-steps communication. It has some important service items:keypurpose__ROOT__root events for each feature__SCENARIO__current scenario root event__SCENARIO_START__current scenario start datetime (in UTC)__STEP__current step eventRequirementsPrepared th2 test environment;Configuration for th2 CommonFactory inconfigs/directory;How to use tablesImagine, that you need to pass data as table in some step:| field1 | field2 | ... | fieldN |
| 1      | 2      | ... | 3      |
...
| valN   | valK   | ... | valM   |You need to declare dataclass with header definition:@dataclassclassSomeRow:field1:strfield2:str...fieldN:strAdd field and converter at the desired step definition@given(parsers.cfparse("some step description{var1}...\n{table}",),converters={"table":Table(SomeRow)},# converter setup)defsome_step(var1,table:Table[SomeRow]):# Syntax hints via generics...How to start test process (with installed plugin)pytesttests/How to start test process (without installed plugin)exportPYTHONPATH=path/to/directory/with/this/repository:$PYTHONPATHpytest-pth2_bdd.pytesttests/
Package: pytest-threadleak
Detects tests leaking threadsInstallationYou can install “pytest-threadleak” viapipfromPyPI:$ pip install pytest-threadleakUsageThe threadleak pytest plugin will fail leaking threads. This can be an issue in
the test, or in the tested code.Here is an example leaking test:$ cat leak_test.py
import threading
import time

def test_leak():
    threading.Thread(target=time.sleep, args=(1,)).start()Here is an example run with thread leak plugin enabled:$ pytest --threadleak leak_test.py
...
leak_test.py::test_leak FAILED
...
>   ???
E   Failed: Test leaked [<Thread(Thread-1, started 139762716391168)>]If you want to enable thread leak by default, you can enable it in your
pytest.ini or tox.ini:[pytest]
threadleak = TrueIf you want to enable thread leak on a per test/module basis, you can
use thethreadleakpytest marker:To enable it for a single test:@pytest.mark.threadleak
def test_leak():
   ...To disable it for a single test:@pytest.mark.threadleak(enabled=False)
def test_leak():
   ...For an entire test module:import pytest

pytestmark = pytest.mark.threadleak(enabled=False)If you want to exclude some threads from the leak check, you can specify a
regex to match excluded thread names:[pytest]
threadleak = True
threadleak_exclude = pool/\d+ContributingRunning the tests:$ toxLicenseDistributed under the terms of theMITlicense, “pytest-threadleak” is free
and open source softwareCreditsThisPytestplugin was generated withCookiecutteralong with@hackebrot’sCookiecutter-pytest-plugintemplate.
Package: pytest-timeit
A pytest plugin to time test function runsFeaturesTODORequirementsTODOInstallationYou can install “pytest-timeit” viapipfromPyPI:$ pip install pytest-timeitUsageTODOContributingContributions 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-timeit” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.ThisPytestplugin was generated withCookiecutteralong with@hackebrot’sCookiecutter-pytest-plugintemplate.
Package: pytest-timeouts
pytest-timeoutsLinux-only Pytest plugin to control durations of various test case execution phases.DocumentationFor documentation visitpytest-timeouts.readthedocs.io.AboutThis plugin has been designed for specific use cases which are out of the scope of famouspytest-timeoutplugin.
It uses aSIGALRMsignal to schedule a timer which breaks the test case.Featuressetup,executionandteardownphase timeouts controllable by:opts:--setup-timeout,--execution-timeoutand--teardown-timeoutini:setup_timeout,execution_timeoutandteardown_timeoutmark:setup_timeout,execution_timeoutandteardown_timeoutfixed order of timeout settings:opts>markers>ini, controlled by--timeouts-order--timeouts-orderallow change order of override timeout settings, and disable some settings, i.e.--timeout-order idisable markers and opts, any combination is allowtimeout disabled when debugging with PDBInstallationStablepipinstallpytest-timeoutsMasterpipinstallgit+https://github.com/Scony/pytest-timeouts.gitUsageCommand linepytest--setup-timeout2.5--execution-timeout2.01--teardown-timeout0pytest.inisetting[pytest]setup_timeout=2.5execution_timeout=2.01teardown_timeout=0Markimporttimeimportpytest@pytest.mark.setup_timeout(0.3)@pytest.mark.execution_timeout(0.5)@pytest.mark.teardown_timeout(0.4)deftest_timeout():time.sleep(1)ContributorsPawel LampeKamil Luczak
Package: pytest-timer
pytest-timerPorting ofnose-timerplugin for pytest. A timer plugin for pytest (how much time does every test take?).InstallTo install the latest release from PyPI:pip install pytest-timerTo installpytest-timerwithtermcolorfor colored durations:pip install pytest-timer[termcolor]To installpytest-timerwithcoloramafor colored durations:pip install pytest-timer[colorama]Or to install the latest development version from Git:pip install git+git://github.com/skudriashev/pytest-timer.gitOr to install the latest from source:git clone https://github.com/skudriashev/pytest-timer.git
cd pytest-timer
pip install .You can also make a developer install if you plan on modifying the
source frequently:pip install -e .UsageAfter installingpytest-timerplugin the following report will be added:========================== pytest-timer ==========================
[success] tests/test_plugin.py::TestPlugin::test_loaded2: 0.0002s
[success] tests/test_plugin.py::TestPlugin::test_loaded: 0.0002sHow do I show only thenslowest tests?For example, to show only the10slowest tests, run pytest with the--timer-top-nflag:pytest --timer-top-n 10How do I turn off pretty colors?In some cases, you may want to disable colors completely. This is done by using the--timer-no-colorflag.
This is useful when running tests in a headless console.How do I filter results by colors?It is possible to filter results by color. To do so, you can use the--timer-filterflag:pytest --timer-filter ok
pytest --timer-filter warning
pytest --timer-filter errorOr to apply several filters at once:pytest --timer-filter warning,errorLicensepytest-timeris MIT Licensed library.ContributeCheck for open issues or open a fresh issue to start a discussion around a feature idea or a bug.Fork the repository on GitHub to start making your changes to the master branch (or branch off of it).Write a test which shows that the bug was fixed or that the feature works as expected.Send a pull request and bug the maintainer until it gets merged and published.Make sure to add yourself to the author's file in setup.py and the Contributors section below :)Contributors@skudriashev
Package: pytest-timestamper
pytest-timestamperPytest plugin to add a timestamp prefix to the pytest output.➜ myproject python3 -m pytest -v
==================================== test session starts ====================================
platform darwin -- Python 3.9.4, pytest-6.3.0.dev494+g43faea832.d20210528, py-1.10.0, ...
cachedir: .pytest_cache
rootdir: /Users/user/myproject
plugins: timestamper-0.1.dev14+gaacde4a
collected 3 items

[2021-06-06 12:19:06] tests/test_one.py::test_dummy PASSED                            [ 33%]
[2021-06-06 12:19:06] tests/test_one.py::test_dummy_two PASSED                        [ 66%]
[2021-06-06 12:19:06] tests/test_two.py::test_another_dummy PASSED                    [100%]

===================================== 3 passed in 0.02s =====================================MotivationFor various reasons tests can be slower on some runs than other.
However, without a timestamp in front of the test it is not clear to the user how long the current test has been taking.
This plugin adds a simple timestamp in front of the pytest output.Installationpip install pytest-timestamperUsageTo activate the plugin one simply needs to install it.
The user can update the format of the prefix with the--prefixfmtand the datetime format with--datefmt.
Package: pytest-tiny-api-client
pytest-tiny-api-clientAn official companion pytest plugin for thetiny-api-clientlibrary.frommy_apiimportMyClientdeftest_my_client(api_call):api_call.return_value={"name":"Peter"}user=MyClient().find_user(user_id=...)assertuser.name=="Peter"One of the problems with testing functions that have been decorated is that
decoration happens at import time, which means the decorators cannot
be patched within each test without having to re-import the modules.This plugin will patch these decorators at import time, and allow you to patch
the implementation during testing. To make this easier, this plugin exposes theapi_callfixture, which is aunittest.mock.Mockobject which can be used to
test your endpoint methods with fake data.For more details on how to use this fixture, check the documentation.Installationpipinstallpytest-tiny-api-clientDocumentationYou can find the documentation athttps://tiny-api-client.readthedocs.ioLicenseThis software is distributed under theLesser General Public License v2.1, more information available at theFree Software Foundation.
Package: pytest-tinybird
pytest-tinybirdA pytest plugin to report test results to tinybirdRequirementsPython >=3.8pytest 3.8 or newer (previous versions might be compatible)Installation$pythonsetup.pyinstallNot viapipyetUsageYou just need atinybirdaccount and token with append permissionsSet this env variablesTINYBIRD_URL=<https://api.tinybird.co|https://api.us-east.tinybird.co># depends on your regionTINYBIRD_DATASOURCE=<datasource_name># will be created with first results postedTINYBIRD_TOKEN=<token_with_append_permissions>Just run pytest with--report-to-tinybird.$pytesttests--report-to-tinybirdCI execution info is filled using some env variables, the ones from GitLab.CI_COMMIT_SHA
CI_JOB_ID
CI_JOB_NAME
CI_JOB_URLIn case you are not using GitLab you need to set it manually. For instance for GitHub actions you can check
currentGitHub actions workflow)You can check the data source schema with thisdata sampleof this repo CI executions.
Package: pytest-tipsi-django
Table of ContentsInstallationFeaturesDefault django test settingsAPI helpersOther fixturesLicenseInstallation$pipinstallpytest-tipsi-djangoFeaturesDefault django test settingsif you run pytest after install pytest-tipsi-django,
Configuration already has django settings.CACHE[‘default’]of course if you has Custom django settings, this settings to below are ignored.DEFAULT_FILE_STORAGE='django.core.files.storage.FileSystemStorage'BROKER_BACKEND='memory'CACHES={'default':{'BACKEND':'django.core.cache.backends.locmem.LocMemCache','TIMEOUT':60*15}}API helpersThere is built-in fixtureanonymouse_clientand you can create helpers for your users wrapping them withpytest_tipsi_django.client_fixtures.UserWrapper.It provides you usefull helpers for all request types.expectedparameter in<METHOD>_jsonis very usefull to prevent tedious status code checks.frompytest_tipsi_django.client_fixturesimportUserWrapperdeftest_00_anonymous(anonymous_client,some_url):query_params={'filter':'query'}body={'param1':'param''}anonymous_client.get_json(some_url,query_params,expected=401)anonymous_client.post_json(some_url,body,expected=403)json_response=anonymous_client.patch_json(some_url,body)anonymous_client.put_json(some_url,body)anonymous_client.delete_json(some_url)@pytest.fixturedefuser_client(user_object):yieldUserWrapper(user_client)deftest_01_authorized(user_client,some_url):resp_json=user_client.get_json(some_url,expected=200)Other fixturesdebug_db_queries- prints performed queriesLicensepytest-tipsi-django is distributed under the terms of theMIT License.
Package: pytest-tipsi-testing
Table of ContentsInstallationLicenseMotivation and featuresUsecaseFixturesvprintlog_requestsInstallationpytest-tipsi-testing is distributed onPyPIas a universal
wheel and is available on Linux/macOS and Windows and supports
Python 3.5+.$pipinstallpytest-tipsi-testingLicensepytest-tipsi-testing is distributed under the terms of theMIT License.Motivation and featuresWe want to make fixtures more predictable in pytest. So this plugin ensures that only loaded fixtures will be available when test is running.Currently pytest allows fixtures with bigger scopes (session, module and etc.) to be instantiated even if test doesn’t directly require them. This may cause some troubles in several cases, for example if you wan’t to create some kind of cache in bigger fixture.This means that all not required fixtures will be finished before test is started: even with bigger scope. So if you want to have some fixtures always awailable (eg. docker_start fixture with session scope) - you should make it autoused.Also we’re forcing correct order for fixtures with different scopes: session -> module -> class -> function.UsecaseIn conjunction withpytest-tipsi-djangoyou can make fixtures on different level than scope and share the same database state across different tests. It’s quit helpful when you perform complex and long database setup and want to have small and readable test cases.Please seepytest-tipsi-djangodocumentation for more detailed description.FixturesvprintPrint that works only when verbose mode is enabled-v.Note: you should add-sto see the output.log_requestsUse it when you want to write down all request/responses made withrequestslibrary. By default it will put docs into.docdir or other directory supplied byDOCS_ROOTenvironmental variable.defexample(log_requests):importrequestswithlog_request('out_file'):r=requests.get('http://echo.jsontest.com/key/value/one/two')assertr.status_code==200,rIt will put json file into your.doc/{MODULE_PATH}.out_file.json, in my case it was a.doc/tests.test_log_requests.out.jsonyour case may be different depending on module you have used it in.