Saravanan666/pypi-org huggingface dataset:
Package: pytest-autochecklog
Please use pytest-oot plug-in, which provides same functions and much more.This pytest plugin is very simple, which is for users who use test_steps in py.test framework.
Use this plugin, the function detection mechanism is using pytest runtest_setup to do it, instead of
using the original mechanism, which requires users know more about the auto-function-detection while
writing scripts originally.
Now, it will be all set, while taken care of by this plugin.Install pytest-autochecklogpip install pytest-autochecklogUsingGiven the following tests (suppose it is in file /test_steps_example/test1.py)fromtest_stepsimport*importrandomdeftest_example():ok("just pass the check and log it")#fail("Just fail the check and log it")ok(3+2==5,"pass if expr else fail")#eq("Shanghai", "Beijing", "Shanghai not equal to Beijing")eq(4+5,9)ne("Shanghai","Beijing","Pass, Shanghai not equal to Beijing")#'Shanghai City' contains 'Country', the second parameter could be regexcheck(" 'Shanghai City' =~ 'Country' ",warning=True)unmatch("Shanghai City","Country","Pass, not contains, regex can be used too")check('random.uniform(1,20) > 15',repeat=5)After installed the plugin for pytest, when you run pytest with the above test case,
then, you will get the following log in logfile /tmp/test_yyyymmdd_hhmm.log by default like:Steven-Mac:tmp Steven$ cat test_20150124_1545.log
2015-01-24 15:45:11,184 - INFO - ------------------------------------------------------
2015-01-24 15:45:11,197 - INFO - Func test_example in file: /test_steps_example/test1.py
2015-01-24 15:45:11,198 - INFO - Check-1: just pass the check and log it -PASS-
2015-01-24 15:45:11,198 - INFO - Check-2: pass if expr else fail -PASS-
2015-01-24 15:45:11,198 - INFO - Check-3: 9 == 9 -PASS- 9 == 9?
2015-01-24 15:45:11,199 - INFO - Check-4: Pass, Shanghai not equal to Beijing -PASS- 'Shanghai' != 'Beijing'?
2015-01-24 15:45:11,202 - INFO - Check-5: 'Shanghai City' =~ 'Country' -PASS- 'Shanghai City' =~ 'Country'
2015-01-24 15:45:11,202 - WARNING -   ^^^  condition not met (pass due to -w option set)  ^^^
2015-01-24 15:45:11,203 - INFO - Check-6: Pass, not contains, regex can be used too -PASS- 'Shanghai City' !~ 'Country'?
2015-01-24 15:45:13,204 - DEBUG -    vvv  Results(-r 5 set) { 1:<11.960281812565919 > 15>  2:<12.284208523480407 > 15>  3:<15.89909604817515 > 15>  }  vvv
2015-01-24 15:45:13,204 - INFO - Check-7: random.uniform(1,20) > 15 -PASS- 15.89909604817515 > 15 - tried 3 times in 5 secondsBtw, you can change the log file and format by using test_steps functions.See more information about test_steps modulehttps://pypi.python.org/pypi?:action=display&name=test_steps
Package: pytest-auto-parametrize
This is an alternative to the rejected pull request#780ofpytest.InstallationJust get it fromPyPI:python3 -m pip install pytest-auto-parametrize --userUsageThis is an example for the usage of aparametrized testwithout using this
plugin:importpytesttestparams=[(1,2,3,4,5,6,7),(7,6,5,4,3,2,1),]@pytest.mark.parametrize('a, b, c, d, e, f, g',testparams)deftest_many_args(a,b,c,d,e,f,g):assertd==4The argument list has to be repeated, which is annoying.By using this plugin, the repetition can be avoided:importpytesttestparams=[(1,2,3,4,5,6,7),(7,6,5,4,3,2,1),]@pytest.auto_parametrize(testparams)deftest_many_args(a,b,c,d,e,f,g):assertd==4The auto-deduced parameters must be in the beginning of the parameter list, but
any other parameters can be used afterwards, e.g. fixtures:importpytesttestparams=[(1,2,3,4,5,6,7),(7,6,5,4,3,2,1),]@pytest.fixturedefmyfixture():return4@pytest.auto_parametrize(testparams)deftest_many_args_and_fixture(a,b,c,d,e,f,g,myfixture):assertd-myfixture==0LimitationsUnlike@pytest.mark.parametrize(...)the decorator@pytest.auto_parametrize(...)cannot be used multiple times for the same
test function.  It can be used together with one or multiple instances of@pytest.mark.parametrize(...), though, as long as the “auto” arguments are
in the beginning of the argument list.
Package: pytest-avoidance
Makes pytest skip tests that don’t need rerunningHow pytest-avoidance avoids testsEach test is run with coverage enabled.After running each test,pytest-avoidancestores a list of which files
each test touched.The next time a test run is requested,pytest-avoidancechecks if any
of the files covered by this test have changed. If none have, the test can
be delared toPASS, even without running it!pytest-avoidancedoes not cache failures. Mostly because AFAIUbazeldoesn’t either, and I’m just guessing they have good reasons not
to…InstallationYou can install “pytest-avoidance” viapipfromPyPI:$ pip install pytest-avoidanceIssuesIf you encounter any problems, pleasefile an issuealong with a detailed
description.ContributingContributions are very welcome. Please run tests before making PRs:$ tox –parallel=auto –skip-missing-interpreters=trueReleasing a new VersionDogit tag | catand think about what the next version number should be.Dogit tag--annotate1.2.3to set the next version number. The
text you write for this tag will show up as the release description on Github,
write something nice! And remember that the first line is the subject line for
the release.tox-epypigit push--tagsYour release should now be visible on thepytest-avoidance page on Pypi.LicenseDistributed under the terms of theMITlicense, “pytest-avoidance” is free
and open source software.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.
Package: pytest-aws-config
pytest_aws_configTinyPytestplugin that mocks your AWS configuration in tests, making your tests independent of the configuration on the developer machine. In particular, it prevents your tests from accessing your AWS credentials.Why is this useful?Developers often use AWS configuration files to store (temporary) credentials to IAM users/roles. This is very useful to access the AWS account from the command line. But it also means that tests will run with these credentials.> export AWS_PROFILE=production
> aws logs describe-log-groups  # analyze some issue on production
> ... time passes ...
> ... write some code ...
> pytest tests  # execute testsWhoops! These tests just ran with access to your production account. Hopefully everything was correctly mocked or patched.InstallationJust install this plugin withpip install pytest_aws_config. No configuration necessary.What about functional tests?Of course, some of your tests may actually need AWS credentials. You have two options:Disable the plugin when running functional tests:pytest -p no:pytest_aws_configKeep the plugin and use some other mechanism (e.g. a pytest fixture) to set the configuration in the test. Then your tests remain independent of the configuration on the developer machine.LinksAWS documentation onconfiguration filesandenvironment variables.
Package: pytest-aws-fixtures
Pytest AWS fixturesThis is a collection of fixtures we've been using to perform integration tests using
real AWS services.Usage of any of these fixture requires that the credentials be configured for boto3 via
one of the following documented methods that does not involve setting the credentials on
the client or session objects:https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.htmlThe fixtures themselves are heavily documented so please view their docstrings for more
information on their usage.
Package: pytest-axe-playwright-snapshot
pytest-axe-playwright-snapshotA pytest plugin that runs Axe-core on Playwright pages and takes snapshots of the results.InstallationInstall the plugin:python3-mpipinstallpytest-axe-playwright-snapshotInstall Playwright browsers:python3-mplaywrightinstall--with-depsUsageIn your tests, use thepagefixture from pytest-playwright along with our plugin'saxe_pytest_snapshotfixture. Once you've navigated to a page, callaxe_pytest_snapshotwith thepagefixture as an argument:fromplaywright.sync_apiimportPagedeftest_violations(page:Page,axe_pytest_snapshot):page.goto("https://www.example.com")axe_pytest_snapshot(page)When you run a test for the first time, you must tell it explicitly to save a snapshot:pytest--snapshot-updateThe plugin will take a snapshot of the page and save it to a file in thesnapshotsdirectory. The snapshot directory will be named after the test function, and the file will be named 'violations.txt'.On subsequent runs, the plugin will compare the latest snapshot against the snapshot and report any difference in the violations.
Package: pytest-azure-devops
Simplifies using azure devopsazure devops parallel strategywith pytest.Instead of using a powershell as inParallelTestingSample-Pythonto
do the test selection we we can tell pytest to directly take care of
selecting the right subset.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.InstallationYou can install “pytest-azure-devops” viapipfromPyPI:$ pip install pytest-azure-devopsUsageJustpip installpytest-azure-devopsbefore running pytest on azure devops and make sure you usejobs:-job:tests_parallel_cistrategy:parallel:2steps:-script:python -m pip install --upgrade pytest-azure-devopsdisplayName:'Installdependencies'-script:python -m pytest mytestsdisplayName:'Runpytest'
Package: pytest-bandit
A bandit plugin for pytestThispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesExecutebandittesting against a repositoryRequirementsBandit > 1.4.0InstallationYou can install “pytest-bandit” viapipfromPyPI:$ pip install pytest-banditUsageaddbandit_targetsto your pytest configuration and add at least one directory to traverseyou probably wantbandit_recurse = truein your configuration as wellContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.Development setup & testingpython -m venv .venv
source .venv/bin/activate
pip insatll tox
toxLicenseDistributed under the terms of theMITlicense, “pytest-bandit” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-bandit-xayon
A bandit plugin for pytestThispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesExecutebandittesting against a repositoryRequirementsBandit > 1.4.0InstallationYou can install “pytest-bandit” viapipfromPyPI:$ pip install pytest-banditUsageaddbandit_targetsto your pytest configuration and add at least one directory to traverseyou probably wantbandit_recurse = truein your configuration as wellContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.Development setup & testingpython -m venv .venv
source .venv/bin/activate
pip insatll tox
toxLicenseDistributed under the terms of theMITlicense, “pytest-bandit” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-base-url
pytest-base-url is a simple plugin forpytestthat provides an optional base
URL via the command line or configuration file.RequirementsYou will need the following prerequisites in order to use pytest-base-url:Python 3.8+ or PyPy3InstallationTo install pytest-base-url:$pipinstallpytest-base-urlContributingWe welcome contributions.To learn more, seeDevelopmentSpecifying a Base URLRather than repeating or abstracting a base URL in your tests, pytest-base-url
provides abase_urlfixture that returns the specified base URL.importurllib2deftest_example(base_url):assert200==urllib2.urlopen(base_url).getcode()Using the Command LineYou can specify the base URL on the command line:$pytest--base-urlhttp://www.example.comUsing a Configuration FileYou can specify the base URL using aconfiguration file:[pytest]base_url=http://www.example.comUsing an Environment VariableYou can specify the base URL by setting thePYTEST_BASE_URLenvironment variable.Using a FixtureIf your test harness takes care of launching an instance of your application
under test, you may not have a predictable base URL to provide on the command
line. Fortunately, it’s easy to override thebase_urlfixture and return
the correct URL to your test.In the following example alive_serverfixture is used to start the
application andlive_server.urlreturns the base URL of the site.importurllib2importpytest@pytest.fixturedefbase_url(live_server):returnlive_server.urldeftest_search(base_url):assert200==urllib2.urlopen('{0}/search'.format(base_url)).getcode()Available Live ServersIt’s relatively simple to create your ownlive_serverfixture, however you
may be able to take advantage of one of the following:Django applications can usepytest-django’slive_serverfixture.Flask applications can usepytest-flask’slive_serverfixture.Verifying the Base URLIf you specify a base URL for a site that’s unavailable then all tests using
that base URL will likely fail. To avoid running every test in this instance,
you can enable base URL verification. This will check the base URL is
responding before proceeding with the test suite. To enable this, specify the--verify-base-urlcommand line option or set theVERIFY_BASE_URLenvironment variable toTRUE.Skipping Base URLsYou canskip testsbased on the value of the base URL so long as it is
provided either by the command line or in a configuration file:importurllib2importpytest@pytest.mark.skipif("'dev' in config.getoption('base_url')",reason='Search not available on dev')deftest_search(base_url):assert200==urllib2.urlopen('{0}/search'.format(base_url)).getcode()Unfortunately if the URL is provided by a fixture, there is no way to know this
value at test collection.ResourcesRelease NotesIssue TrackerCode
Package: pytest-bdd-html
Apytestplugin to displayBDDinfo in thepytest-html-generated HTML test report.Apart frompytest-html, it plugs intopytest-bddplugin’s hooks.UsageTo use the plugin, just install it:# source .venv/bin/activatepipinstallpytest-bdd-htmlpytest-vv...If you usetox, list the plugin as a dependency:; tox.ini[testenv]deps=...pytest-bdd-htmlcommands=pytest -vv ...There will be a new3rd columnwith label “Description” in the test report specified by--html=...command line option ofpytest-html.Command line optionsAvailable command line options are as follows.--bdd-html-css=PATHSpecifies a path to a custom CSS file for styling of the Description column.pytest_bdd_html/resources/style.cssis used by default ifPATHdoes not exist or is not specified. SeeCSS classesfor how the column cells are structured.CSS classesFor each test case (one row in thepytest-html-generated HTML report), the Description column’s cell has one of the following structures, differing for BDD and non-BDD tests (.XXXdenotes a HTML element with CSSclass="XXX").Structure of cell for BDD test.col-description
  .col-description-bdd-doc
    /* Feature */
    div
      h3
      .text
         div /* feature name */
         div /* feature description; optional */

    /* Scenario */
    div
      h3
      .text

    /* Steps */
    div
      h3
      .steps
        .step /* one or more steps */
          .step-name
          .step-messageStructure of cell for non-BDD test with functional comment.col-description
  .col-description-func-docStructure of cell for non-BDD testwithoutfunctional comment.col-description
  .col-description-no-doc /* an empty div */Version updatebumpver test -p 0.1.13a0 "MAJOR.MINOR.PATCH[PYTAGNUM]"
bumpver update -n -d -p
bumpver update -n -p
Package: pytest-bdd-ng
pytest-bdd-ngcombine descriptive clarity ofGherkinlanguage
with power and fullness ofpytestinfrastructure.
It enables unifying unit and functional
tests, reduces the burden of continuous integration server configuration and allows the reuse of
test setups.Pytest fixtures written for unit tests can be reused for setup and actions
mentioned in feature steps with dependency injection. This allows a true BDD
just-enough specification of the requirements without obligatory maintaining any context object
containing the side effects of Gherkin imperative declarations.NoteProject documentation:pytest-bdd-ngInstall pytest-bdd-ngpip install pytest-bdd-ngProject layoutpytest-bdd-ngautomatically collect*.featurefiles frompytesttests directory.
Important to remember, that feature files are used by other team members as live documentation,
so it’s not a very good idea to mix documentation and test code.The more features and scenarios you have, the more important becomes the question about
their organization. So recommended way is to organize your feature files in the folders by
semantic groups:features
├──frontend
│  └──auth
│     └──login.feature
└──backend
   └──auth
      └──login.featureAnd tests for this features could be organized in the next manner:tests
└──conftest.py
└──functional
│     └──__init__.py
│     └──conftest.py
│     │     └── "User step library used by descendant tests"
│     │
│     │         from steps.auth.given import *
│     │         from steps.auth.when import *
│     │         from steps.auth.then import *
│     │
│     │         from steps.order.given import *
│     │         from steps.order.when import *
│     │         from steps.order.then import *
│     │
│     │         from steps.browser.given import *
│     │         from steps.browser.when import *
│     │         from steps.browser.then import *
│     │
│     └──frontend_auth.feature -> ../../features/frontend/auth.feature
│     └──backend_auth.feature -> ../../features/backend/auth.feature
...Step definitions could be organized in the next waysteps
└──auth
│     └── given.py
│     │      └── """User auth step definitions"""
│     │          from pytest import fixture
│     │          from pytest_bdd import given, when, then, step
│     │
│     │          @fixture
│     │          def credentials():
│     │             return 'test_login', 'test_very_secure_pass'
│     │
│     │          @given('User login into application')
│     │          def user_login(credentials):
│     │             ...
│     └── when.py
│     └── then.py
└──order
│     └── given.py
│     └── when.py
│     └── then.py
└──browser
│     └── ...
...To make links between feature files at features directory and test directory there are few options
(for more information please investigate project tests):Symlinks.desktopfiles.weblocfiles.urlfilesNoteLink files also could be used to load features byhttp://
Package: pytest-bdd-report
Thepytest-bdd-reportplugin is a useful extension for thepytest-bddlibrary that allows you to generate
useful and informative reports for BDD (Behavior-Driven Development) tests developed using the pytest-bdd framework.
This plugin facilitates the generation of clear and effective HTML reports, providing a comprehensible view of BDD test executions within the project.Thispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesDetailed BDD Reports: The pytest-bdd-report plugin enables the generation of detailed reports for BDD tests executed using pytest-bdd. These reports clearly show the executed steps, tested scenarios, and obtained results.HTML Format: The generated reports are presented in an intuitive and interactive HTML format. This allows developers, testers, and other team members to easily view the status of BDD tests.Easy Installation: Installing the plugin is simple and fast. You can install it using the commandpip install pytest-bdd-report.RequirementsJinja2pytestpytest-bddInstallationEnsure that you havepytestandpytest-bddinstalled in your development environment.Open a terminal window.Execute the following command to install thepytest-bdd-reportplugin viapipfromPyPI$ pip install pytest-bdd-reportUsageOnce installed, you can generate BDD reports in an HTML file using the following command:$ pytest --bdd-report="report.html"Run testsTo run tests:Create a virtual environmentInstall the required packages:$ pip install -r requirements.txtInstall the plugin locally:$ pip install -e .Run the tests:$ python -m pytestContributingContributions are very welcome. Tests can be run withpytestas shown.LicenseDistributed under the terms of theMITlicense, “pytest-bdd-report” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-bdd-splinter
pytest-bdd-splinterThis module provides a number of commongiven,when,thensteps forpytest-splinterinpytest-bddInstallationpipinstallpytest-bdd-splinterNumber of examplesScenario:Fill in a formGivenI am using a large deviceAndI am on the homepageWhenI go to "/my-contact-form/"AndI fill in the following:|first_name|John||last_name|Doe||username|johndoe||password|mysecret|AndI press "agree-tos"AndI press "submit"ThenI should be on "/thank-you/"AndI should see "Thank you for creating an account"More informationPlease seethe documentationto read more about installation, configuration and an overview of all the
available steps.
Package: pytest-beakerlib
A pytest plugin that reports test results to the BeakerLib framework.pytest:http://pytest.org/latest/BeakerLib:https://fedorahosted.org/beakerlib/Once installed, this plugin can be activated via the--with-beakerliboption.
This requires a BeakerLib session (i.e.rlJournalStartshould have been run,
so that$BEAKERLIBis set)DownloadingRelease tarballs are available for download from Fedora Hosted:https://pagure.io/releases/python-pytest-beakerlib/You can also install using pip:https://pypi.python.org/pypi/pytest-beakerlib/0.2The plugin is also available in Fedora repositories aspython3-pytest-beakerlib.OperationA Bash process is run on the side, and BeakerLib commands (rlPhaseStart,rlPhaseEnd,rlPass,rlFail, …) are fed to it.
This is not very elegant, but since BeakerLib commands are Bash functions,
there is no way around running Bash.IntegrationOther plugins may integrate with this using pytest’sconfig.pluginmanager.getplugin('BeakerLibPlugin'). If this isNone,
BeakerLib integration is not active, otherwise the result’srun_beakerlib_commandmethod can be used to run additional commands.ContributingThe project is happy to accept patches!
Please file any patches as Pull Requests on the project’sPagure repo.
Any development discussion should be in Pagure Pull Requests and Issues.Developer linksBug tracker:https://pagure.io/python-pytest-beakerlib/issuesCode browser:https://pagure.io/python-pytest-beakerlib/tree/mastergit clonehttps://pagure.io/python-pytest-beakerlib.gitUnstable packages for Fedora:https://copr.fedoraproject.org/coprs/pviktori/pytest-plugins/To release, update version in setup.py, add a Git tag like “v0.3”,
and runmake tarball.
Runningmake uploadwill put the tarball to Fedora Hosted and PyPI,
and a SRPM on Fedorapeople, if you have the rights.
Runningmake releasewill upload and fire a COPR build.
Package: pytest-beartype
pytest-beartypePytest plugin to run your tests with beartype checking enabled.Installationpipinstallpytest_beartypeUsagepytest--beartype-packages='your_package_name,other_package_name'This will ensure that any type annotations in those packages are checked at
runtime, while your tests are running.Local Development / TestingCreate and activate a virtual environmentRunpip install -r requirements-dev.txtto do an editable installRunpytestto run testsType CheckingRunmypy .Create and upload a package to PyPIMake sure to bump the version insetup.cfg.Then run the following commands:rm-rfbuilddist
pythonsetup.pysdistbdist_wheelThen upload it to PyPI usingtwine:twineuploaddist/*