Saravanan666/pypi-org huggingface dataset:
Package: pytest-travis-fold
Pytestplugin that folds captured output sections in Travis CI build log.In addition, pytest-travis-fold recognizes presence of thepytest-covplugin
and folds coverage reports accordingly.Installation and UsageJust install thepytest-travis-foldpackage as part of your build.When usingtox, add the package to thedepslist in yourtox.iniand make sure theTRAVISenvironment variable is passed:[testenv]
deps =
    pytest-travis-fold
passenv = TRAVISIf youdon’tuse tox and invokepy.testdirectly from.travis.yml,
you may install the package as an additionalinstallstep:install:
  - pip install -e .
  - pip install pytest-travis-fold

script: py.testOutput folding is enabled automatically when running inside Travis CI. It is OK
to have the plugin installed also in your dev environment: it is only activated
by checking the presence of theTRAVISenvironmental variable, unless the--travis-foldcommand line switch is used.ThetravisfixtureThe plugin by itself only makes the captured output sections appear folded.
If you wish to make the same thing with arbitrary lines, you can do it manually
by using thetravisfixture.It is possible to fold the output of a certain code block using thetravis.folding_output()context manager:def test_something(travis):
        with travis.folding_output():
                print('Lines, lines, lines...')
                print('Lots of them!')
                ...Or you may want to use lower-leveltravis.fold_string()andtravis.fold_lines()functions and then output the result as usual.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-travis-fold” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-trello
Plugin for py.test that integrates with trello using markers.
Integrationallows tests to xfail (or skip) based on the status of linked trello
cards.Release History0.0.7 (2015-11-20)Add support for –show-trello-cards to display currently configured
trello markers0.0.6 (2015-04-23)Protect against exceptions from the trello library0.0.5 (2015-04-08)Remove flake8 from setup_requires0.0.4 (2015-04-07)Fix an issue during egg_info when pandoc is not installed0.0.3 (2015-04-06)Plugin will warn, but not fail when providing bogus –trello-cfg
options0.0.2 (2015-04-06)New –trello-cfg YAML formatSupport for 401 trello authentication errors0.0.1 (2015-04-01)No joke, first release!
Package: pytest-trepan
AbstractA pytest plugin for running thetrepan debuggerUsingAfter installing, to set a breakpoint to enter the trepan debugger:import pytest
def test_function():
    ...
    pytest.trepan()    # get thee into the debugger!
    x = 1
    ...The above will look like it is stopped at thepytest.trepan()call. This is most useful when this is the last statement of a
scope. If you want to stop instead beforex = 1passimmediate=Falseor justFalse:import pytest
def test_function():
    ...
    pytest.trepan(immediate=False)
    # same as py.trepan(False)
    x = 1
    ...You can also pass as keyword arguments any parameter accepted bytrepan.api.debug().To have the debugger entered on error, use the--trepanoption:$ py.test --trepan ...Project DetailsProject code + issue track on github -https://github.com/rocky/pytest-trepanPyPI -https://pypi.python.org/pypi/pytest-trepan
Package: pytest-trialtemp
py.test plugin for using the same _trial_temp working directory as trialusageInstall the plugin withpip installpytest-trialtempand it will be used
automatically when tests are run.To disable it for a particular run, usepy.test-pno:trialtemp[...]to
run your tests. See pytest’s documentation for further options.why?I frequently usepy.testto run Twisted tests written usingtrial. This
works pretty well on its own, except trial’s temporary directory infrastructure
assumes the working directory during test runs is./_trial_tempor
something similar.In order to avoid littering my project root with annoying test-created
temporary directories, I wrote this little plugin.
Package: pytest-trio
This is a pytest plugin to help you test projects that useTrio, a friendly library for concurrency
and async I/O in Python. For an overview of features, see ourmanual, or jump straight to thequickstart guide.Vital statisticsDocumentation:https://pytest-trio.readthedocs.ioBug tracker and source code:https://github.com/python-trio/pytest-trioLicense:MIT or Apache 2, your choice.Code of conduct:Contributors are requested to follow ourcode of
conductin all project spaces.
Package: pytest-tstcls
pytest-tstclsTest Class BaseHow to useSimple TestsfromtstclsimportTestClassBaseclassTestMyClass(TestClassBase):defsetup_test(self):self.tester=MyClass()deftest_my_method(self):###self.tester.my_method()###Use MocksfromtstclsimportTestClassBaseclassTestMyClass(TestClassBase):defsetup_test(self):self.my_mocked_dependency=Mock()self.tester=MyClass(self.my_mocked_dependency)deftest_my_method(self):self.my_mocked_dependency.return_value=123###self.tester.my_method()###Use fixtures as usualfromtstclsimportTestClassBaseclassTestMyClass(TestClassBase):@pytest.fixturedefmy_fixture(self):return321defsetup_test(self,my_fixture):self.tester=MyClass(my_fixture)deftest_my_method(self,my_fixture):###self.tester.my_method()###
Package: pytest-typechecker
pytest-typecheckerthis is a plugin for pytest that allows you to create tests
that verify how a type checker responds to your code.This currently supports these type checkers:pyrightmypyFile name formatthis plugin looks for files starting withtestand ending withtypes.pyortypes_xfail.py.
for exampletest_something_types.pyglobal xfailif you want to mark the hole test asxfailend it withtypes_xfail.py, for example.# test_wrong_types_xfail.pyx:123="abc"y:str=123Only run specific checkersif you include the name of a checker with_around it only those checkers will be run.
for exampletest_recursion_pyright_types.pyxfail specific checkersif you provide axbefore the checker name, it will be run in xfail mode.
for exampletest_recursion_xmypy_types.pywill run all checkers, but mark the mypy one asxfailif you only want to run mypy and have it be xfail use this workaround:test_recursion_mypy_types_xfail.pythis can be combined, for exampletest_recursion_pyright_xmypy_types.pywill run only pyright and mypy, but run mypy in xfail mode.dont run specific checkersif you provide anbefore the checker name, it will not be run.
for exampletest_recursion_nmypy_types.pywill run all checkers, except mypy.
Package: pytest-typhoon-config
pytest-typhoon-configA pytest plugin that facilitates test parameter configuration at runtimeFeaturesspecify test parameters in a python module, just like any otherchoose which module to use at runtimeThis way you can define different parameter sets for the same test suite and
choose them at runtime.Requirementspytest 6+InstallationYou can installpytest-typhoon-configviapip:pip install pytest-typhoon-configUsageCreate a test parameter definition file as a Python module, such as this:# myparams.py
import numpy as np

a_list = [277.0, 278.0]
a_numpy_range = np.arange(58, 63, 0.2)
even_values = [v for v in range(20) if v % 2 == 0]

class StayConnected:
    some_list = [22, 45, 85, 95]
    some_param = 0.95All module attributes will be injected at runtime intytest.config.runtime_settings.Configclass. They will be available as
class-level attributes ofConfig. That means you can use them
like this:from tytest.runtime_settings import Config as C

@python.mark.parametrize('param1', C.even_values)
def test_something(param1):
    passIn this exampleeven_valuesvariable will be initialized inmyparams.pymodule, and then injected intoConfigclass. It is available in all test
code asConfig.even_values.This way you can create different python modules with the same variables,
having different values, and then choose which module to use when invoking
pytest. For example:pytest --runconfig=myparams.pyThe path of this file is evaluated at runtime.ContributionsContributions 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 the MIT license,pytest-typhoon-configis
free and open source software.
Package: pytest-ubersmith
Mock out calls to the python-ubersmith libraryUsagepytest-ubersmith makes it really easy to mock out API calls:importubersmith.clientdeftest_add_client(ubermock):client_id=1234ubermock.client.add=client_idassertubersmith.client.add(login='test',password='abc')==1234# Easy checking of callsassertubermock.client.add.calledassertubermock.client.add.call_count==1ubermock.client.add.assert_called_once_with(login='test')ubermock.client.add.assert_called_once_with_exactly(login='test',password='abc')To have python-ubersmith raise a ResponseError, return anubermock.ResponseError:importubersmith.clientimportubersmith.exceptionsdeftest_unknown_client(ubermock):ubermock.client.get=ubermock.ResponseError('Invalid client!',1)withpytest.raises(ubersmith.exceptions.ResponseError):ubersmith.client.get(client_id=1234)If you need complete control over the response, you can return the whole
Ubersmith JSON response:importpytestimportubersmith.clientimportubersmith.exceptionsdeftest_unknown_client_raw(ubermock):ubermock.client.get.raw_response={'status':False,'data':'','error_message':'Invalid client','error_code':1,}withpytest.raises(ubersmith.exceptions.ResponseError):ubersmith.client.get(client_id=1234)You can even pass a callable for dynamic responses:importpytestimportubersmith.clientimportubersmith.exceptionsdeftest_dynamic_client(ubermock):defget_client(method,params,request,context):ifparams['client_id']=='1':return{'client_id':1}else:raiseubermock.ResponseError('Invalid client!',1)ubermock.client.get=get_clientassertubersmith.client.get(client_id=1)=={'client_id':1}withpytest.raises(ubersmith.exceptions.ResponseError):ubersmith.client.get(client_id=2)
Package: pytest-ui
pytest-uiText User Interface for running python tests. Still inbetaversioninstallationinstall using pippip install pytest-uiprovides the cli commandpytuiusage$ pytui --help
Usage: pytui [OPTIONS] [PATH]

Options:
  --debug / --no-debug  Enable debug logging  [default: False]
  --help                Show this message and exit.pypi addresshttps://pypi.python.org/pypi/pytest-uikeyboard controlsr,F5- run tests (last failed or first run, using filter)R,Ctrl+F5- run all tests (using filter)s- run single test under cursor/- focus filter inputCtrl+f- clear filter input and focus itF4- toggle show only failed testsAlt+Up/Down- navigate between failed tests (skipping passed)q- close window, quit (in main window)filter inputBy default, filter input is in fuzzy mode. This could be avoided by using dash signs,
where exact match mode is used between a pair of them. For exampleabc#match#defwill match fuzzy "abc", then exactly "match" and then again fuzzy "def"main goalsThe goal of this project is to ease the testing process byselecting tests to run using fuzzy filterviewing failed tests stacktrace/output/log while the test suite is still runningrerunning failed testsrunning a test with debuggerusage as pytest plugin (for custom pytest scripts)
Package: pytest-unflakable
Unflakable Plugin for PyTestThis Unflakable plugin enables users of thePyTestPython test framework
to quarantine flaky tests and track test results.Refer to thePyTest Plugindocumentation for
complete usage instructions. Users of the Pythonunittestunit testing frameworkmay use this
plugin by leveraging PyTest'sout-of-the-box supportfor runningunittesttests.CompatibilityThis plugin maintains compatibility with the PyTest and Python versions listed below:ContributingTo report a bug or request a new feature, pleasefile a GitHub issue.
We also welcome pull requests!
Package: pytest-unhandled-exception-exit-code
Plugin forpytestto change exit code on uncaught exceptionsFree software: MIT licenseFeaturesYou can set a different exit code when uncaught exceptions inpytesttest
cases will occurInstallationYou can install the plugin by runningpip install pytest-unhandled-exception-exit-codeAlternately check out the source code and runpython setup.py installUsageIf you want to changepytestexit code to detect unhandled exceptions in
tests, give the plugin the desired exit code with the following option:pytest--unhandled-exc-exit-code13
Package: pytest-unique
Pytestfixture to generate unique values.RequirementsYou will need the following prerequisites to use pytest-unique:Python 3.8, 3.9, 3.10, 3.11, 3.12InstallationTo install pytest-unique:$pipinstallpytest-uniqueUsageYou can use theuniquefixture by passing it as a test argument:deftest_integer(unique):assertunique("integer")>0Here are some of the plugins available by default:byteswith invalid UTF8 characters.digitswith just numbers.emailwith a unique username.floatwith a whole part and a decimal part.integerwithbaseandmodarguments.passwordwithlowercase,uppercase,digitsandpunctuationarguments.textwithprefix,suffixandseparatorarguments.ExtensionsTheuniquefixture can be extended with custom plugins:fromdatetimeimportdatetime,timezonedefunique_datetime(unique)"""Return a datetime unique to this factory instance."""timestamp=unique("integer")returndatetime.fromtimestamp(timestamp,timezone.utc)Then, add it to thepyproject.tomlfile of your project:[tool.poetry.plugins."pytest_unique.unique"]
datetime = "your_project.unique:unique_datetime"You can then use the plugin like all other plugins:fromdatetimeimportdatetimedeftest_datetime(unique):assertisinstance(unique("datetime"),datetime)LimitationsTheuniquefixture cannot be used as parameters in parameterized tests
by virtue of being a fixture. The reason it is a fixture rather than a
function is that unique values are generated from an instance of a counter
that returns sequential values. This makes it possible to see the order
in which values were generated which can be useful when troubleshooting.ResourcesDocumentationRelease NotesIssue TrackerSource CodePyPi
Package: pytest-unittest-filter
pytest-unittest-filterA pytest plugin for filtering unittest-based test classesDescriptionpytesthasunittest-based testssupport out of the box. It eases incremental transition from legacy test suite topytestfor existing projects, but it has one drawback: there is no way to exclude some test cases (unittest.TestCasesubclasses) from collection.pytesthaspython_classesconfig option, but, as noted in documentation, this option doesn't affectunittest.TestCasesubclasses:Note that unittest.TestCase derived classes are always collected regardless of this option, as unittest‘s own collection framework is used to collect those tests.It's probably OK for projects that uses builtinunittesttest runner (python -m unittest) because the latter has no any include/exclude option either, but it can be inconvenient if a project test suite is used withnosetest runner and relies onhard-codedleading underscore filter.The plugin provides two new config options:python_unittest_classesandpython_unittest_exclude_underscore.python_unittest_classesThis option works like thepython_classesoption mentioned above but forunittest.TestCasesubclasses:One or more name prefixes or glob-style patterns determining which classes are considered for test collection. Search for multiple glob patterns by adding a space between patterns.A default value isnone(no value), i.e. allunittest.TestCasesubclasses are collected by default.Examplesto include only classes with names starting withTestorCheck:[pytest]python_unittest_classes=Test* Check*or alternatively:[pytest]python_unittest_classes=Test Checkto include only classes with names ending withTestCase:[pytest]python_unittest_classes=*TestCaseto exclude classes with names starting with underscore:[pytest]python_unittest_classes=[!_]*python_unittest_exclude_underscoreThis boolean option can be used to mimichard-codednose selector behaviour. If the option set totrue, all classes with names that start with_will be excluded. Thus, the last example above can be rewritten as following:[pytest]python_unittest_exclude_underscore=trueA default value isfalse.Both options can be combined. The following two examples are equivalent:[pytest]python_unittest_classes=[!_]*Test [!_]*Check[pytest]python_unittest_classes=*Test *Checkpython_unittest_exclude_underscore=trueChangelog0.2.1 (2019-01-12)Fixed bug wherepython_unittest_exclude_underscorewas applied to any collected item, not only unittest classes0.2.0 (2019-01-11)Addedpython_unittest_exclude_underscoreoption0.1.0 (2018-10-27)Initial releaseLicenseMIT License
Package: pytest-unstable
Provides a test mark@pytest.mark.unstable.If tests marked as unstable fail, Pytest will still return 0. Failures will still be present in the reports.RequirementsPython >=3.6PytestInstallationYou can install “pytest-unstable” via pip fromPyPI:$ pip install pytest-unstableUsageMark tests as unstable@pytest.mark.unstableIf those tests fail (and no other test), pytest will return 0Go read the reports to see the failures!LicenseDistributed under the terms of theMITlicense, “pytest-unstable” is free and open source software
Package: pytest-unused-fixtures
pytest-unused-fixturesA pytest plugin to list unused fixtures after a test run.The plugin watches all fixtures which are used in a test run, and then compares it to all the fixtures available in the same test collection. It then prints out all the fixtures which were not used, groupped by where they were defined.Running the tests is required to accurately record which fixtures are used, as pytest provides ways of dynamically requesting fixtures, and pure static analysis will not catch those.Installation$pipinstallpytest-unused-fixturesUsageAfter installing the package, the plugin is enabled by adding the switch--unused-fixtures.Paths of fixtures can be ignored with one or multiple--unused-fixtures-ignore-patharguments. For example--unused-fixtures-ignore-path=venvwill ignore all fixtures defined in thevenvfolder.Ignoring specific fixtures from reportSometimes there will be fixture which are unused on purpose, for example when used in tests which are skipped by default. A decorator is provided for ignoring fixtures from the unused report. See the example for usage:importpytestfrompytest_unused_fixturesimportignore_unused_fixture@pytest.fixture@ignore_unused_fixturedefignored_fixture():passDevelopmentPoetry(dependencies) andpre-commit(coding standards) are required for development. There are some tests, obviously written inpytest.$poetryinstall
$pre-commitinstall
$pytesttestsThanksMany thanks topytest-deadfixturesfor inspiration for this projectpytest-durationsfor inspirations in parts of the implementationChangelog0.1.3 (Jun 30, 2023)Print line numberSupport Python 3.90.1.2 (Jun 15, 2023)Fix typo, add repository to PyPIUpdate location handling with respect to showing fixture locations and ignoring paths0.1.1 (Jun 14, 2023)Fix location handlingAdd decorator for ignoring fixtures from report0.1.0 (Jun 14, 2023)First Release
Package: pytest-upload-report
English |简体中文pytest-upload-report is a plugin forpytestthat upload your test report for test results.FeaturesUpload report for allure-pytest.Upload report for pytest-html.RequirementsPython >= 3.7pytestrequestsallure-pytest, if you use allure report.pytest-html, if you use html report.InstallationYou can install “pytest-upload-report” viapipfromPyPI:$ pip install pytest-upload-reportUsageA simple exampleDirectly upload report files  to server by upload_url.On the command line, addupload_urloption when runpytestcommand:pytest --alluredir=/tmp/my_allure_results --upload_url=http://127.0.0.1:8000/uploadA complete exampleNow let us demonstrate how to use in a vaguely real world scenario.First, you must have a upload api on server, an example for fastapi:from fastapi import APIRouter, UploadFile, File, Header

router = APIRouter(prefix='/api/script', tags=['script'])

@router.post("/reports/upload")
async def report_upload_by_api(
    project_id: int,
    timestamp: int,
    username: str,
    sign: str = Header(...),
    files: List[UploadFile] = File(...),
):
    ...
    return 'ok'Second, edit your conftest.py file, addpytest_send_upload_requesthook:import pytest

@pytest.hookimpl(tryfirst=True)
def pytest_send_upload_request(upload_url, files, config):
    from pytest_upload_report.upload_client import SignUploadClient
    client = SignUploadClient(upload_url, files)
    client.send_request(config)
    return TrueThe other hooks will be blocked from executing, when then hook returnTrue.
If you want to upload multiple places, don’t write any return.Third, edit pytest.init on you test project root dir:[pytest]
addopts = --alluredir=/tmp/my_allure_results --upload_url=http://127.0.0.1:8000/api/script/reports/upload --upload_project_id=4 --upload_username=admin --upload_secret=8FB6CFB4C8CF11EBB523DCA9048E18C3Finally, run pytest command on you test project root dir:$ pytestAlso, you can view source code in the example directory.How to CustomizeIf the above does not meet your needs, you can customize request client.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-upload-report” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: py-test-utility
py-test-utilityContains a collection of class and functions which aim to help developers implement and test data pipelines against the new generation data warehouses and storing system i.e. BigQuery and GCSInstallationpy-test-utility can be installed via pippipinstallpy-test-utilitymockdata - class csv_mock(csv,schema)Extract the equivalent json from csv with nested and repeated records structuresArgscsvpath and file name of the csvmandatorynested fields shall be separated by a dot "."  (i.e. item.id, item.quantity)orderitem.iditem.quantitydelivery.addressdelivey.postcodeA0001item15address1e13bpitem21item33A0002item44address4e13bpitem14item32schemapath and schema file name of the table schemarequired if the CSV contain nested and repeated recordsjson format i.e.[{"mode":"NULLABLE","name":"order","type":"STRING"},{"fields":[{"mode":"NULLABLE","name":"id","type":"STRING"},{"mode":"NULLABLE","name":"quantity","type":"STRING"}],"mode":"REPEATED","name":"item","type":"RECORD"},{"fields":[{"mode":"NULLABLE","name":"address","type":"STRING"},{"mode":"NULLABLE","name":"postcode","type":"STRING"}],"mode":"NULLABLE","name":"delivery","type":"RECORD"}]Methodsto_json()if successfuls return the json extracted from the csvUsage>>>frommockdataimportmockdataasmd>>>mockdata_csv=md.csv_mock(...csv="mockdata/test/data/csv/repeated_records.csv",...schema="mockdata/test/schema/repeated_records_schema.json")# initialise the object>>>mockdata_json=mockdata_csv.to_json()# return the equivalent json