Saravanan666/pypi-org huggingface dataset:
Package: pytest-gc
The garbage collector plugin for py.test.InstallationInstall the plugin with:$ pip install pytest-gcUsageThere are a few options to use this plugin:Disable automatic garbage collection when running tests withgc-disable.Set the garbage collection thresholds usinggc-thresholdoption.Also, set the scope for the plugin’s fixtures withgc-scope, defaultfunction.So, for example, if you wanna change the gc thresholds for test run, just type:$ pytest --gc-threshold 5 7 8 --gc-scope sessionNotesThe repository of this plugin is athttps://github.com/vtitor/pytest-gc.For more info on py.test seehttp://pytest.org.
Package: pytest-gcs
Pytest GCSThis is a pytest plugin in similar vein topytest-postgresandpytest-kafka.This would have been much more painful withoutMirakuruandfake-gcs-server; this is a simple wrapper around
those tools.SetupThis tool requires you to have a copy of thefake-gcs-serverbinary somewhere on your path.Demo# conftest.pyfrompytest_gcs.factoriesimportclientasgcs_clientfrompytest_gcs.factoriesimportprocasgcs_process# Create a process and a local client that targets that process.gcs_proc=gcs_process.gcs_proc()gcslocal=gcs_client.gcslocal("gcs_proc")# tests/test_gcs.pyfromgoogle.cloudimportstoragefrompytest_gcs.executor.processimportGCSExecutordeftest_can_create_gcs_bucket(gcs_proc:GCSExecutor,gcslocal:storage.Client)->None:"""MVP to ensure everything works."""bucket="test_base"gcslocal.create_bucket(bucket)buckets=[x.nameforxingcslocal.list_buckets()]assertbucketinbucketsContributingPRs are accepted.# Install the dependencies with:pipinstall.[test]# Install pre-commit hooks.pre-commitinstall# Validate everything passes.pre-commitrun--all# Run the tests.pytesttests/TODOsImplement the events outputs,-event.bucket,-event.list, etc.
Package: pytestgen
Getting tired of manually writing unit test stubs for your Python code? Easy.Example# file: example.pydeftestable_func(arg_one,arg_two):passclassAClass:def__init__(self,some,constructor,params):passdeftestable_func_in_class(self,an_arg):pass$pytestgenexample.py# file: test_example.pyimportpytestimportexample@pytest.mark.parametrize("arg_one,arg_two,expected",[# TODO: fill in test data for test_testable_func# pytest.param(, , id="")])deftest_testable_func(arg_one,arg_two,expected):# TODO: create assertions for test_testable_func# example.testable_func(arg_one, arg_two)pass@pytest.mark.parametrize("instance,an_arg,expected",[# TODO: fill in test data for test_aclass_testable_func_in_class# pytest.param(example.AClass(some, constructor, params), , expected, id="")])deftest_aclass_testable_func_in_class(instance,an_arg,expected):# TODO: write test for test_aclass_testable_func_in_class# TODO: create assertions for test_aclass_testable_func_in_class# instance.testable_func_in_class(an_arg)passInstallation$pipinstallpytestgenUsage# generate tests for directory 'my_package' in 'tests/' directory$pytestgenmy_package# generate tests for some python files and directory 'the_package'$pytestgenmy_module_a.pyanother_module.pythe_package# generate tests for directory 'cool_app' in 'cool_tests/' directory$pytestgencool_app-ocool_tests# generate tests for functions 'foo' and 'bar' in 'functionality.py'$pytestgenfunctionality.py-ifoo-ibarFull usage textUsage: pytestgen [OPTIONS] PATH...

  Generate pytest unit tests from your Python source code.

Options:
  -o, --output-dir PATH  The path to generate tests in.  [default: tests]
  -i, --include FUNC     Function names to generate tests for. You can use
                         this multiple times.
  -h, --help             Show this message and exit.LicenseMIT
Package: pytest-gevent
pytest-geventEnsure that gevent is properly patched when invoking pytestinstallationpip install pytest-geventusagewherever you'd usepytest, usepytest-geventinstead.disabling specific patchesyou can disable specificgevent patchesthrough environment variables.  for
example, if you wanted to disable thesslpatch you would invoke:PYTEST_GEVENT_PATCH_ALL_NO_SSL=1pytest-geventhow this worksthis callsgevent.monkey.patch_all(...)and thenpytest.main()alternativesgevent.monkeyprovides a cli directly, though it's quite clunky to usepython-mgevent.monkey$(whichpytest)...# with gevent 1.5+ you'll be able to do# python -m gevent.monkey --module pytest ...
Package: pytest-gherkin
A flexible framework for executing BDD gherkin testsFeaturesTODORequirementsTODOInstallationYou can install “pytest-gherkin” viapipfromPyPI:$ pip install pytest-gherkinUsageTODOContributingContributions 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-gherkin” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-gh-log-group
pytest github log grouping pluginThis plugin provides grouping functionality for GitHub action console view.Usagepip install pytest_gh_log_groupplugin name:pytest_gh_log_groupactivated by env variable:GITHUB_ACTIONS. By default, GitHub action have this variable.NOTEGitHub does not currently support nesting groups.pytest prints outcome letters (.sxFE) by default, and it can't be turned off.
This behaviour causes conflict with GitHub grouping functionality and this library
not yet solve conflict perfectly.
However, pytest can be customized in many ways, including the outcome printing which potentially solves this conflict.
Package: pytest-gitcov
pytest-gitcovExtension for pytest to report on the coverage for the lines modified in a given commit or commit range. The vision is to be able to run pytests on a code base before submitting a pull request or code review, to see the lines of code that were modified by you but not covered by unit-tests.Issues this plugin is trying to resolveIdeally the whole code base will have reasonable coverage. Realistically though this is rarely the case with a legacy code base. The repository wide coverage report means little in terms of one developers merge request. The hope is that using this plugin you can shine a light on the code you have touched. Making it easier to spot gaps in unit tests due to code you have written, or modified and identify a gap someone else left and should really be filled.Just reporting a list of line ranges covered on the terminal is not much help. I can't remember the line numebers for the functions I've just changed, and working out where the gaps are is time consuming. The HTML report is a lot better for this, but I'd like to have something quick and simple for the terminal.InstallNice and easy:pip install pytest-gitcovUsageThis is still in very early stages of development and doesn't really do much yet.After installing, the plugin is automatically found by pytest. At the moment that means that the plugin always runs with eachpytestrun and you have to uninstall to disable it. Soon there should be an extra argument that can be used to temporarily disable this. For example, respect the existingpytest-covflag (--no-cov) as well as a new--no-gitcovflags.There is also a standalone script available to generate a git coverage report on previous.coverageDB file, for more info seegit-py-coverage --help.The planSo far it just dumps a report at the end of a test run. Report contains the raw info available in the .coverage file (SQLLite3 DB) prsed using thecoverage.CoverageDataproxy (https://coverage.readthedocs.io/en/coverage-5.0/api_coveragedata.html#coverage.CoverageData).The plan is to usegit diff --name-statusorgit diff --name-onlyto get a list of files changed. Then usegit blameto get the lines with line numbers changed for each file in current commit (perhaps with some context as well +/- 3 lines, or maybe later a whole function).Then show the lines in the commit that are not in the coverage report.Outcome:plugin for pytest that reports on current HEAD commitstand-alone git-py-coverage script to run on the last .coverage report. This could be used to generate another report, against a differnt commit without having to run the tests again.
Package: pytest-github-actions-annotate-failures
pytest-github-actions-annotate-failuresPytestplugin to annotate failed tests with aworkflow command for GitHub ActionsUsageJust install and run pytest with this plugin in your workflow. For example,name:teston:push:jobs:test:runs-on:ubuntu-lateststeps:-uses:actions/checkout@v3-uses:actions/setup-python@v4with:python-version:3.7-name:Install dependenciesrun:|python -m pip install --upgrade pippip install -r requirements.txt-name:Install pluginrun:pip install pytest-github-actions-annotate-failures-run:pytestIf your test is running in a Docker container, you have to install this plugin and manually setGITHUB_ACTIONSenvironment variable totrueinside of Docker container. (For example,docker-compose run --rm -e GITHUB_ACTIONS=true app -- pytest)If your tests are run from a subdirectory of the git repository, you have to set thePYTEST_RUN_PATHenvironment variable to the path of that directory relative to the repository root in order for GitHub to identify the files with errors correctly.Screenshot
Package: pytest-github-report
Pytest GitHub ReportThis is an example of how we can useGitHub reportswithpytestto
generate a nice markdown matrix of results. Thetestshere are from thepytest-md-reportrepository.UsageLocalFirst, install dependencies:$pipinstall-rrequirements.txtAnd then run tests to see the markdown output (that will get piped into GitHub):$pytest--github-reporttests/This markdown output is provided viapytest-md-reportand you can see other ways to customize it there!GitHub ActionsTo make this work in GitHub actions, it's actually very simple! You can either
run the same command:-name:Report via Command Linerun:pytest --github-report testsOr export via the environment (e.g., good if you don't want to change your default
testing command but want it to work during GitHub actions).-name:Report via Environmentenv:pytest_github_report:truerun:pytest testsConfigurationAdvanced configuration can be done via the environment since we are scoping to GitHub
actions.EnableIf you want to have the report work from the environment (ideal if you don't want to
change the command to run your tests) you can do:exportpytest_github_report=trueIf that value is found with any none Null value (e.g., True or yes) a report
will be generated given this module is installed.TitleTo set a particular title for your report:-name:Report via Environmentenv:pytest_github_report:truepytest_report_title:"Formatting"run:pytest testsZerosBy default, we only show colored emojis to indicate a success or failure.
To use a count (value) instead:-name:Report via Environmentenv:pytest_github_report:truepytest_use_zeros:truerun:pytest testsBlanksOr a blank value:-name:Report via Environmentenv:pytest_github_report:truepytest_use_blanks:truerun:pytest testsDetailBy default, we output a simplified view, which ispytest_verbosity: 0. You actually have two options for verbosity:
This first is the default (0), which shows a summary by file:-name:Report via Environmentenv:pytest_verbosity:0run:pytest --github-report testsNotice below that although the table shows summary by file, the output section shows both failures
within the file:The second shows per test results (adding the function name) and adds more detail to the matrix:-name:Report via Environmentenv:pytest_verbosity:2run:pytest --github-report testsIn this case, the detail is on the level of the function.
But either way, detail is printed below the matrix, as you can see above!EmojisChoose the emijos (or characters) you want for your tests! A helpfulemoji guide is here.-name:Report via Environmentenv:pytest_github_report:truepytest_report_title:":unicorn:ReportWithCustomEmojis:unicorn:"pytest_passed_emoji:":green_heart:"pytest_failed_emoji:":heart:"pytest_xpassed_emoji:":bangbang:"pytest_xfailed_emoji:":bangbang:"pytest_skipped_emoji:":shipit:"run:pytest testsHere is an example with the custom emojis above!You can see theGitHub workflowfor these examples.Thanks!The markdown functionality here is based off ofthombashi/pytest-md-reportwhich is released under an MIT license that we credit in.github/LICENSE.
Package: pytest-gitignore
This py.test plugin will tell py.test to ignore any file that git
ignores, when it’s collecting tests.  For example, if you keep virtualenvs
in your source directory, you can have both git and py.test ignore them
by putting them in your .gitignore.  To see whether a file is ignored
by git, rungit check-ignore (filename).This plugin is registered as ‘gitignore’.
Package: pytest-gitlabci-parallelized
pytest-gitlabci-parallelizedParallelize pytest across GitLab CI workers.This pytest plugin is inspired and based onpytest-circleci-parallelized.FeaturesLeverage the builtin parallelism of GitLab CI to run your test suites.  Callpytestwith theCI_NODE_INDEXandCI_NODE_TOTALenvironment variables set or use the--ci-node-indexand--ci-node-totalswitches to split tests amongst nodes.Read more about the GitLab CI parallel test splittinghere.# .gitlab-ci.ymltests:stage:testscript:pytestparallel:5InstallationYou can install "pytest-gitlabci-parallelized" via pip fromPyPI.pipinstallpytest-gitlabci-parallelizedContributingContributors welcome! Tests can be run withpytest.LicenseDistributed under the terms of theMITlicense,pytest-gitlabci-parallelizedis free and open source software.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-gitlab-fold
pytest-gitlab-foldPytestplugin that folds output sections in GitLab CI build log.It is a port of Eldar Abusalimov's excellentpytest-travis-foldplugin,
all credits go to him and contributors.In addition, pytest-gitlab-fold recognizes presence of thepytest-covplugin and folds coverage reports accordingly.Installation and UsageJust install the [pytest-gitlab-fold][linnk-pypi] package
as part of your build.When usingtox, add the package to thedepslist in yourtox.iniand make sure theGITLAB_CIenvironment variable is passed:[testenv]deps=pytest-gitlab-foldpassenv=GITLAB_CIIf youdon'tuse tox and invokepy.testdirectly from.gitlab-ci.yml,
you may install the package as an additionalinstallstep:install:-pip install -e .-pip install pytest-gitlab-foldscript:py.testOutput folding is enabled automatically when running inside GitLab CI. It is OK
to have the plugin installed also in your dev environment: it is only activated
by checking the presence of theGITLAB_CIenvironmental variable, unless the--gitlab-foldcommand line switch is used.ThegitlabfixtureThe 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 thegitlabfixture.It is possible to fold the output of a certain code block using thegitlab.folding_output()context manager:deftest_something(gitlab):withgitlab.folding_output():print("Lines, lines, lines...")print("Lots of them!")...Or you may want to use lower-levelgitlab.fold_string()andgitlab.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-gitlab-fold" is
free and open source software.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed
description.
Package: pytest-gnupg-fixtures
pytest-gnupg-fixturesOverviewPytest fixtures to dynamically createGnuPGinstances for testing.Getting StartedUpdatesetup.pyto include:fromdistutils.coreimportsetupsetup(tests_require=["pytest-gnupg-fixtures"])All fixtures should be automatically included via thepytest11entry point.frompytest_gnupg_fixturesimportGnuPGKeypair# Optional, for typingdeftest_custom_signer(gnupg_keypair:GnuPGKeypair):custom_signer=CustomSigner(keyid=gnupg_keypair.fingerprints[1],passphrase=gnupg_keypair.passphrase,homedir=gnupg_keypair.gnupg_home,)assert"PGP SIGNATURE"incustom_signer.sign("my data")Tested with python 3.8InstallationFrompypi.org$ pip install pytest_gnupg_fixturesFrom source code$gitclonehttps://github.com/crashvb/pytest-gnupg-fixtures
$cdpytest-gnupg-fixtures
$virtualenvenv
$sourceenv/bin/activate
$python-mpipinstall--editable.[dev]Fixturesgnupg_emailProvides a generated email to use as part of the uid for the keypair.gnupg_gen_key_confProvides the path to a templated GnuPG script file that is used to generate a temporary keypair. If a user-defined script (tests/gnupg_gen_key.conf) can be located, it is used. Otherwise, an embedded script template is copied to temporary location and returned. This fixture is used by thegnupg_keypairfixture.The$GNUGP_EMAILand$GNUPG_PASSPHRASEvariables will be populated within the template during generation of the keypair.gnupg_keypairProvides a keypair within a temporary GnuPG trust store.NamedTuple FieldsThe following fields are defined in the tuple provided by this fixture:email- fromgnupg_emailfingerprints- A list of key fingerprints. Typically: pubkey, subkey...gnupg_home- fromgnupg_trust_storekeyid- The public key id of the temporary keypair.gen_key_conf- fromgnupg_gen_key_confpassphrase- fromgnupg_passphrasescript- The path to the instantiated script fromgnupg_gen_key_confuidsA list of uids existing within the trust store.Typing is provided bypytest_gnupg_fixtures.GnuPGKeypair.gnupg_passphraseProvides a generated passphrase to use for the keypair.gnupg_trust_storeProvides a temporary, initialized, GnuPG trust store that is contains no keys. This fixture is used by thegnupg_keypairfixture.NamedTuple FieldsThe following fields are defined in the tuple provided by this fixture:gnupg_home- The path to the temporary trust store.Typing is provided bypytest_gnupg_fixtures.GnuPGTrustStore.LimitationsThis has been coded to work with gpg2.The generated keypair is very simple. TBD if this will be expanded to support a more realistic configuration.DevelopmentSource Control
Package: pytest-goldie
pytest-goldie is a pytest plugin that enablesgolden testingusing pytest framework.
Golden testing is a methodology that compares the output of your code with a pre-recorded output. This package provides a fixture calledgoldenthat can be used to update test results and make test comparisons.ExampleFirst, install the plugin:$pipinstallpytest-goldieThen, in your test file, use thegoldenfixture:defmy_function():return"Hello, world!"deftest_my_function(golden):output=my_function()golden.test(output)Thegolden.testmethod takes the output of your function and compares it to the saved output of a previous run. If theupdate_goldensflag is set, pytest-goldie will update the saved output with the new output.To run the tests and update goldens, use the following command:$pytest--update_goldensBy default, the golden files are stored in a folder named ‘goldens’. You can change the folder name with –goldens_folder flag:$pytest--goldens_foldermy_goldensThis will set the goldens folder to “my_goldens” instead of the default “goldens”.LicenseThis software is licensed under theMIT License.Created by Nick Kartashov and contributors.
Package: pytest-google-chat
pytest-google-chatNotify google chat channel for test resultsInstallationUsageCommand line optionsUsing a config fileUsing environment variables:ContributingLicenseIssues🧰 InstallationYou can install pytest-google-chat viapipfromPyPI:$ pip install pytest-google-chat📖 UsageIn order to use this plugin, you need to provide the command line flag--google-chatanda valid goggle chat webhook.
The webhook, as all the other parameters, can be provided as a command line argument, as a value inside a config file or as an environment variable.Command line optionsOptionDescriptionDefault value--google-chatEnable the plugin (required)This doesn't need a value--gc-webhookThe webhook to send notifications to.Important:Use double or single quotes for the valueNone--report-linkThe link to the reportNone--report-titleThe title of the reportNone--report-subtitleThe subtitle of the reportNone--gc-fail-imageThe url of an image to use when the test failsNone--gc-success-imageThe url of an image to use when the test succeedsNone--gc-configThe path to the config fileNoneUsing a config file[GOOGLE-CHAT]gc_webhook=https://chat.googleapis.com/v1/spaces/AAAA7GkHUoE/messages?key=XXXX&token=YYYYreport_link=https://link.to.reportreport_title=My Reportreport_subtitle=My Report Subtitlegc_fail_image=https://link.to.imagegc_success_image=https://link.to.imageUsing environment variables:REPORT_TITLE="My Report" pytest --google-chat --gc-webhook=https://....❗NOTEAll previous methods can be used combined.
The order of precedence is: command line options > config file > environment variable.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-google-chat" is free and open source software.IssuesIf you encounter any problems, pleasefile an
issuealong with
a detailed description.Thispytestplugin was generated
withCookiecutteralong with@hackebrot'scookiecutter-pytest-plugintemplate.
Package: pytest-group-by-class
Welcome to pytest-group-by-class!pytest-group-by-class allows you to split your test runs into groups of tests that belongs to the same class
to make it easier to split up your test runs.Usage# Install pytest-group-by-class
pip install pytest-group-by-class

# Split the tests into groups based on class and run the second group
py.test --test-group-class --test-group-class-id 2

# Split the tests into groups based on class and run the tests belonging ot class NameOfTheClassToBeExecuted
py.test --test-group-class --test-group-class-name NameOfTheClassToBeExecutedWhy would I use this?Sometimes you may have some long running test jobs that take a
while to complete. This can be a major headache when trying to
run tests quickly. pytest-group-by-class allows you to easily say
"split my tests into groups of classes and run the second group".
This is primarily useful in the context of CI builds.
Package: pytest-harmony
Pytest harmonyA library to make test trees.What is test chains?Test 1 startsTest 1 finishes, output goes to all depending testsTest 2 starts with output from test 1Test 2 finishes, output goes to all depending testsTest 3 startsTest 3 fails, depending tests gets skippedTest 3 cleanup gets calledTest 2 cleanup gets calledTest 1 cleanup gets called
Package: pytest-helm-chart
pytest-kube-providerA plugin to provide different types and configs of Kubernetes clusters that can be used for testing.FeaturesTODORequirementsTODOInstallationYou can install "pytest-kube-provider" viapipfromPyPI:$ pip install pytest-kube-providerUsageTODOContributingContributions are very welcome. Tests can be run withtox_, please ensure
the coverage at least stays the same before you submit a pull request.LicenseSeeLICENSE.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-helper
The pytest-helper package provides several functions which make it easier to
set up and run unit tests in Python using thepytesttesting framework.  For example, there is a function to make modules
self-testing whenever they are executed as scripts, and a function to simplify
making modifications to the Python search path.  One of the most useful
features is that relative pathnames are relative to the directory of the file
in which they occur (i.e., not relative to the CWD).  This package makes use of
pytest but is independent of the official pytest project.For examples and full documentation, seehttps://abarker.github.io/pytest-helperThe easiest way to install is to install from PyPI using pip:pipinstallpytest-helper