Saravanan666/pypi-org huggingface dataset:
Package: pytest-django-gcir
Welcome to pytest-django!pytest-django allows you to test your Django project/applications with thepytest testing tool.Quick start / tutorialChangelogFull documentation:https://pytest-django.readthedocs.io/en/latest/Contribution docsVersion compatibility:Django: 1.8-1.11, 2.0 and latest master branch (compatible at the time of each release)Python: CPython 2.7, 3.4-3.6 or PyPy 2, 3pytest: >2.9.xLicence: BSDProject maintainers: Andreas Pelme, Floris Bruynooghe and Daniel HahlerAll contributorsGitHub repository:https://github.com/pytest-dev/pytest-djangoIssue trackerPython Package Index (PyPI)Install pytest-djangopip install pytest-djangoWhy would I use this instead of Django’smanage.py testcommand?Running your test suite with pytest-django allows you to tap into the features
that are already present in pytest. Here are some advantages:Manage test dependencies with pytest fixtures.Less boilerplate tests: no need to import unittest, create a subclass with methods. Write tests as regular functions.Database re-use: no need to re-create the test database for every test run.Run tests in multiple processes for increased speed (with the pytest-xdist plugin).Make use of otherpytest plugins.Works with both worlds: Existing unittest-style TestCase’s still work without any modifications.See thepytest documentationfor more information on pytest itself.
Package: pytest-django-haystack
pytest-django-haystackpytest-django-haystack is a plugin forpytestandpytest-djangothat rebuilds the Haystack index before every test and clears it again after.Quick startpip installpytest-django-haystackMark tests with thepytest.mark.haystackmarker.You can optionally specify which haystack connection(s) should be used:@pytest.mark.haystack(connection=["test"])
Package: pytest-django-lite
A minimal plugin to integrate Django and py.test.UsageInstall the plugin:pip install pytest-django-liteConfiguring DjangoYou have two options to configure your testsuite’s Django settings.1. Create a conftest.pydefpytest_configure(config):fromdjango.confimportsettingssettings.configure(DATABASES={},INSTALLED_APPS=[],# etc)2. PassDJANGO_SETTINGS_MODULEDJANGO_SETTINGS_MODULE=myapp.settings py.testWrite Testsfromdjango.testimportTestCasefrommyapp.modelsimportFooclassMyTest(TestCase):deftest_foo(self):assertFoo.objects.count()==2NoteThis only supports classical Django tests (class-based inheritence)CreditsThis was originally based onpytest-django.
Package: pytest-django-liveserver-ssl
pytest-django-liveserver-sslAddlive_server_sslfixture for pytest-django.Installationpipinstallpytest-django-liveserver-sslor from gitpipinstall-egit+https://githib.com/Apkawa/pytest-django-liveserver-ssl.git@master#egg=pytest-django-liveserver-sslUsageimportrequestsdeftest_live_server_connection(live_server_ssl):assertlive_server_ssl.remote_url.startswith("https://localhost:")assertlive_server_ssl.url.startswith("http://0.0.0.0:")response=requests.get(live_server_ssl.remote_url,verify=False)assertresponse.text=="OK"
Package: pytest-django-model
A Simple Way to Test your Django ModelsDescriptionThis plugin allows you to simply test your Django models, by writing your tests
as you would write your models. On the other hand, pytest-django-model tests
only fields, constants, and the Meta inner class. You will have to write tests
of methods and properties.The principle here is not really to test the behavior of your models but rather
to make sure that the settings are the right ones.InstallationYou can install “pytest-django-model” viapipfromPyPI:$ pip install pytest-django-modelUsageThe plugin is very easy to use, there are only three things to remember:ThePytestDjangoModelmetaclass.Themodelattribute.Theparentsattribute (optional).Let’s take this model:classFoo(Bar,Baz):classMeta:unique_together=("name","email")FAVORITE_COLOR_CHOICES=(("BL","blue"),("YE","yellow"),("GR","green"),("RE","red"))name=models.CharField(max_length=256)email=models.EmailField(blank=True)favorite_color=models.CharField(max_length=2,choices=FAVORITE_COLOR_CHOICES,default="BL")is_awesome=models.BooleanField(default=True)To test it, we just have to write this:frompytest_django_modelimportPytestDjangoModel# Name of the test class doesn't matter.classTestFoo(metaclass=PytestDjangoModel):classMeta:model=Foo# Parents can be a model or a list/tuple of models.parents=(Bar,Baz)unique_together=("name","email")FAVORITE_COLOR_CHOICES=(("BL","blue"),("YE","yellow"),("GR","green"),("RE","red"))name=models.CharField(max_length=256)email=models.EmailField(blank=True)favorite_color=models.CharField(max_length=2,choices=FAVORITE_COLOR_CHOICES,default="BL")is_awesome=models.BooleanField(default=True)And voila! We can now launch tests with the commandpytest.From there, the classPytestDjangoModelwill generate a fake Django model
from constants, fields and options of the Meta class. This model will inherit
all the models of theparentsattribute.The data ofFoomodel and the model created from theTestFooclass will
be extracted and compared. If any constant differs or isn’t found, pytest will
raise a error, same for fields and Meta options.ContributingContributions are very welcome. Development Environment can be setup withmake setup. Tests can be run withmake test, please ensure the coverage
at least stays the same before you submit a pull request.LicenseDistributed under the terms of theGNU GPL v3.0license,
“pytest-django-model” is free and open source software.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed
description.
Package: pytest-django-ordering
pytest-djangoadvertises “easy switching.” While it’s true that existing unittest-style
tests will work without any modifications, you may have problems switching if you
depend on theorderin which the Django test runner runs tests. This plugin helps
preserve that order if you need it to run your tests.MotivationThe Django test runner gives priority to DjangoTestCasesubclasses, executing them
before other Django-based tests (e.g.,TransactionTestCase) and any otherunittest.TestCasetests. Put differently, Django runs tests which reset the database by rolling back
a transaction before tests which reset the database by truncating all tables.pytest-django doesn’t preserve this ordering out of the box. For more, see#214.
This isn’t a problem if your project’s tests can run independently of each other,
in any order. However, if your project’s tests rely on initial data populated via
fixtures or migrations, tests which reset the database by rolling back a transactionmustrun before tests which reset the database by truncating all tables, thereby
deleting any initial data. Theserialized_rollbackoption can be used to deal with
this issue within aTransactionTestCase, but it has no effect across distinct
test cases; once you exit aTransactionTestCase, any initial data is gone.InstallationThis plugin supports Python 2.7, 3.5, and 3.6. Install withpip:$ pip install pytest-django-orderingYou’re done!pytestwill automatically find and integrate the plugin.
Package: pytest-djangorestframework
A djangorestframework plugin for pytestThispytestplugin was generated withCookiecutteralong with@hackebrot’scookiecutter-pytest-plugintemplate.FeaturesTODORequirementsTODOInstallationYou can install “pytest-djangorestframework” viapipfromPyPI:$ pip install pytest-djangorestframeworkUsageTODOContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theBSD-3license, “pytest-djangorestframework” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-django-rq
pytest-django-rqA pytest plugin to help writing unit test for django-rq.This plugin provides adjango_rq_workerfixture which has awork()method
to run all enqueued jobs in current process.Usagedeftest_async_api(django_rq_worker):client=django.test.Client()# Call an async APIresponse=client.post(URL)assertresponse.status_code==201# Accepted# now let's run all enqueued jobsdjango_rq_worker.work()# assert the async jobs has taken place.assert...
Package: pytest-django-sqlcounts
This plugin adds the number of SQLs executed on the default database connection
per test to the terminal report.All features offered by the default py.test terminal plugin should be available.InstallationInstall with pip:pip install pytest-django-sqlcountUninstallationUninstall with pip:pip uninstall pytest-django-sqlcountUsageRunning tests with SQLCount output:py.test --sqlcount myproj tests/LimitationKeep in mind that test factories and fixtures can create more SQLs than the
tested method/function. SQLs created by those methods are included in the count.
Package: pytest-django-testing-postgresql
Use caseThis pytest plugin can be used to test a Django application that uses
PostgreSQL. It leverages thetesting.postgresqlmodule to setup a
temporary PostgreSQL database server and injects the configuration for it
into Django’s settings. It is intended to be used together withpytest-django.Requirementstesting.postgresqlneeds the postgresql server binary available.How to useTo use, simply install the package in your testing environment and laod
thedjango-testing-psotgresqlplugin when running pytest (pytest normally
auto-discovers it).The plugin re-uses the configuration used bypytest-django.By default, only thedefaultdatabase is setup. You can modify this
by settingPYTEST_SETUP_DATABASESto a list of database aliases in
yoursettingsmodule. The list can contain strings, or tuples if you
want some aliases to share the same database backend.
Package: pytest-doc
pytest-docs allows you to annotate your tests and generate documentation about your tests.pytest testing tool.Quick start / tutorialFull documentation:http://pytest-doc.readthedocs.org/en/latest/Contribution docsVersion compatibility:Python: CPython 2.6-2.7,3.2-3.4 or PyPy 2,3pytest: 2.6.xLicence: BSDProject maintainers: Alfred PerlsteinAll contributorsGithub repository:https://github.com/splbio/pytest-docIssue trackerPython Package Index (PyPI)See thepytest documentationfor more information on pytest itself.
Package: pytest-docfiles
pytest_docfilespytest plugin to test code sections in your documentation.Installationpipinstallpytest_docfilesUsageDefine code sections in your markdown files.<!-- doc.md --># Hello World```pythonprint("hello world!")```run pytest on your markdown files with the--docfilesflag.pytest--docfilesdoc.mdFeaturesSection NamesDefine names for your code sections so they can be better identified in your pytest output<!-- doc.md -->```python{"name": "my-section"}print("hello world")```$pytest--docfilesdoc.md
...
doc.md::my-sectionPASSED
...FixturesDefine your fixtures inconftest.pyas usual# conftest.pyimportpytest@pytest.fixturedefcustom_fixture()->str:return"fixture value"@pytest.fixture(autouse=True)defautouse()->None:"""autouse fixtures are used in each code section"""use the fixtures in your code sections<!-- doc.md -->```python{"fixtures": ["custom_fixture"]}assertcustom_fixture=="fixture value"```ScopesCode section depending on other code section can be executed in scopes.```python{"scope": "my-scope"}value=True``````python{"scope": "my-scope"}assertvalueisTrue```Skip Sections```python{"skip": true}raiseException("this section should not run")```Exception Handling```python{"raises": "RuntimeError"}raiseRuntimeError("this section should pass")```
Package: pytest-dockerc
pytest-dockercpytest-dockercis a plugin forpytestthat provides support
for running test fromDocker Composeproject.
Thedocker-compose up -dcommand is executed at the beginning of the
test session and thedocker-compose downcommand at the end. The main fixturedockercreturns acompose.project.Projectto deal with the python docker API in your tests. Another fixturedockerc_logsis provided to enable
the logs on stdout during your tests execution.This plugin provides a way to use as far as possible the same environment for development, test,
integration and production phases. You test and deploy the same artifact in order to avoid
side effects in production.Installpip install pytest-dockercGetting startedBelow a basic example, you can also refer to a full example with anhttp server.worktree├── docker-compose.yml
└── tests
    ├── conftest.py
    └── test_example.pydocker-compose.ymlversion:"3.6"services:python:image:python:3-alpinetest_example.pydeftest_example(dockerc):assertlen(dockerc.containers())==1container=dockerc.containers()[0]assertcontainer.is_runningisTrueassertcontainer.labels["com.docker.compose.service"]=="python"Available optionsSome options are available to update the default behavior of the plugin.dockerc:
  --dockerc-norun       disable the run and stop commands of docker-compose
  --dockerc-attach-network
                        attach the pytest container to the docker-compose
                        network,only if pytest is started inside a container
  --dockerc-filepath=DOCKERC_FILEPATH
                        set the Compose file path
  --dockerc-projectdir=DOCKERC_PROJECTDIR
                        set the working directory of the Compose project
  --dockerc-projectname=DOCKERC_PROJECTNAME
                        set project name of the Compose project
  --dockerc-build       build images before starting containers
  --dockerc-services=DOCKERC_SERVICES
                        select services to runRun tests without up and down command ofdocker-composeRunning the fulldocker-composeproject can take time, if you loads several services. It is
useful to run the test on a running instance. That method is recommended when you write a new
test.First start your docker compose like usual:docker-compose upThen run your tests with the--dockerc-norun, that will skip theupanddowncommand:pytest --dockerc-norunBelow the docker-compose output after 2 runs of the testtests/test_fixtures::test_basic_workflow,
which performs a GET request.Creating network "pytest-dockerc_default" with the default driver
Creating pytest-dockerc_http_1 ... done
Attaching to pytest-dockerc_http_1
http_1  | 192.168.32.1 - - [24/Dec/2018:08:48:21 +0000] "GET / HTTP/1.1" 200 612 "-" "python-requests/2.20.0" "-"
http_1  | 192.168.32.1 - - [24/Dec/2018:08:48:22 +0000] "GET / HTTP/1.1" 200 612 "-" "python-requests/2.20.0" "-"
Package: pytest-docker-fixtures
Provide various service pytest fixtures.Installpip install pytest-docker-fixturesUsagesIn your conftest.py, add the following:pytest_plugins = ['pytest_docker_fixtures']And to use the fixtures:def test_foobar(redis):
    passAvailable fixturesPRs welcome!cockroach (require to be installed withpip install pytest-docker-fixtures[pg])es (elasticsearch)etcdkafka (require to be installed withpip install pytest-docker-fixtures[kafka])memcached (require to be installed withpip install pytest-docker-fixtures[memcached])miniomysql (require to be installed withpip install pytest-docker-fixtures[mysql])pg (require to be installed withpip install pytest-docker-fixtures[pg])rabbitmq (require to be installed withpip install pytest-docker-fixtures[rabbitmq])redisstripe (stripemock)Configuring custom imagesYou can also configure custom images to use:from pytest_docker_fixtures import images
images.configure(
    'elasticsearch',
    'docker.elastic.co/elasticsearch/elasticsearch-platinum', '6.2.4',
    env={},
    options={}
)1.3.18 (2023-11-17)Remove container object after stopping it [sunbit]1.3.17 (2023-05-02)Set docker api version to auto
[vangheem]1.3.16 (2023-03-24)Use compatibile version of redis with arm support
[vangheem]1.3.15 (2022-11-17)Set Redis image version to 6.2.6 for amd64 arch [albertnadal]1.3.14 (2022-07-06)Add stripe/stripemock image [jotare]1.3.13 (2021-11-23)Support for Apple Silicon images [bloodbare]1.3.12 (2021-08-30)Add support for remote docker daemons [sunbit]1.3.11 (2020-09-30)fix release1.3.10 (2020-09-30)Add memcached docker image [lferran]1.3.9 (2020-07-10)Fix passing options to image configuration
[gitcarbs]1.3.8 (2020-07-02)Stop hardcoding db, user, and password in Postgresql.check()
[marshalium]1.3.7 (2020-05-04)Change psycopg2 dependency to psycopg2-binary1.3.6 (2020-02-14)Update to working postgres image after upstream 9.6 change1.3.5 (2019-10-01)minio: use random port (breaking change!)
[masipcat]1.3.4 (2019-09-04)Be able to override with env variables
[vangheem]1.3.3 (2019-08-14)Add support for MySQL
[masipcat]1.3.2 (2019-07-19)Fix: custom max_wait_s option should not be passed to docker images [lferran]1.3.1 (2019-07-19)Allow configuring time to wait for image to be setup [lferran]1.3.0 (2019-04-05)Be able to configure more of image
[vangheem]Make sure ImportError is bubbled
[vangheem]1.2.10 (2019-02-28)minio: configure a custom version of the image doesn’t work
[masipcat]minio: check() fails because Minio responds with status 403
[masipcat]1.2.9 (2019-01-09)Fix Minio returning port = None
[masipcat]1.2.8 (2019-01-03)Add support for Minio
[masipcat]1.2.7 (2018-11-19)ensure Kafka is available
[ableeb]1.2.6 (2018-11-15)Fix use of optional dependency
[vangheem]1.2.5 (2018-11-13)Add support for Kafka
[ableeb]1.2.4 (unreleased)Add support for RabbitMQ
[davidonna]1.2.3 (2018-06-10)bump1.2.2 (2018-05-06)Fix es when using 6
[vangheem]1.2.1 (2018-05-05)Fix Elasticsearch image
[vangheem]1.2.0 (2018-05-05)Be able to configure custom docker images
[vangheem]1.1.0 (2018-04-03)Add Elasticsearch fixture
[vangheem]1.0.1 (2018-03-12)release1.0.0 (2018-03-12)initial release
Package: pytest-docker-postgresql
A simple Docker PostgreSQL plugin to use with pytest.FeaturesTODORequirementsTODOInstallationYou can install “pytest-docker-postgesql” viapipfromPyPI:$ pip install pytest-docker-postgresqlUsageTODOContributingLicenseDistributed under the terms of theMITlicense, “pytest-docker-postgresql” is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.
Package: pytest-docker-py
pytest-docker-pyEasy to use, simple to extend, externalpytestplugin that minimally leveragesdocker-py.1. IntroductionA plugin that keeps it simple and lets you:pull images - if not already pulled.start containers - with various, optional, parameters - i.e. ports; networks; volumes; commands.stop containers.Seetest/integration/test_plugin.pyfor a working example.2. Installationpip install pytest-docker-pyorpip install git+https://github.com/jameshnsears/pytest-docker-py@masterthencreate a test, similar totest/integration/test_plugin.pyrun pytest -s3. Development / PR - on Ubuntu 18.04sudo apt-get install -y build-essential python3-pip python3-venvgit clonehttps://github.com/jameshnsears/pytest-docker-py.gitcd pytest-docker-py3.1. Create Virtual Environment./create-venv.sh3.2. Unit Tests./run-unit-tests.sh3.3. Integration Tests./run-integration-tests.sh
Package: pytest-docker-service
pytest-docker-servicepytest-docker-serviceis a pytest plugin for writing integration tests based on docker containers.The plugin provides afixtures factory: a configurable function to register fixtures.The package has been developed and tested with Python 3.11, and pytest version 7.4.InstallationInstallpytest-docker-servicewithpip.python -m pip install pytest-docker-serviceUsageYou just have to create a fixture in yourconftest.pyor in individual test modules, using thedocker_containerhelper.
Fixture is created with the scope provided through thescopeparameter.
Other parameters are wrappers around thedocker-pyAPI (https://docker-py.readthedocs.io/en/stable/).importrequestsfrompytest_docker_serviceimportdocker_containercontainer=docker_container(scope="session",image_name="kennethreitz/httpbin",ports={"80/tcp":None},)deftest_status_code(container):port=container.port_map["80/tcp"]status=200response=requests.get(f"http://127.0.0.1:{port}/status/{status}")assertresponse.status_code==statusOf course, if you want to build your own docker image, it is possible.
Just set thebuild_pathparameter pointing to the directory containing the Dockerfile.container=docker_container(scope="session",image_name="my-image",build_path="path/to/dockerfile/directory",ports={"80/tcp":None},)deftest_status_code(container):port=container.port_map.["5432/tcp"]...
Package: pytest-docs
Apytestplugin that generates documentation of the testing application itself.FeaturesCreate documentation of your tests. Turns this:'''This is the module doc'''
import pytest

pytestmark = [
    pytest.mark.module_mark,
    pytest.mark.module_mark_2,
    pytest.mark.pytest_doc(name="Test Docs"),
]


@pytest.mark.class_marker
@pytest.mark.pytest_doc(name="Test Class")
class TestClass:
    '''This is the class doc'''

    @pytest.mark.func_mark_a("foo")
    def test_func_a(self):
        '''This is the doc for test_func_a'''
        assert 1

    @pytest.mark.kwarg_mark(goo="bla")
    def test_func_b(self):
        '''This is the doc for test_func_b'''
        assert 1To this:# Test Docs
This is the module doc

**Markers:**
- module_mark
- module_mark_2
- pytest_doc  (name=Test Docs)
## Test Class
This is the class doc

**Markers:**
- pytest_doc  (name=Test Class)
- class_marker
### test_func_a
This is the doc for test_func_a

**Markers:**
- func_mark_a (foo)
### test_func_b
This is the doc for test_func_b

**Markers:**
- kwarg_mark  (goo=bla)Current supported formats:MarkdownreStrcutured textWhy not sphinx?(More accurately, why not sphinx-autodoc?)
Sphinx is an amazing tool that I use and used in other project. To use its autodoc plugin, it need the documented plugin to be importable by the python interperter. Pytest test collection and invocation uses a completely separate mechanism.
If you believe that it somehow possible to use sphinx to create pytest documentation, please do not hesitate to contact me.RequirementsPython 3.4, 3.5, 3.6 or 3.7Pytest >= 3.5.0InstallationYou can install “pytest-docs” viapipfromPyPI:$ pip install pytest-docsUsageUse--docs[PATH]to create the documentation.Use--doc-typeto select the type (currently supportsmdandrst)Use@pytest.mark.pytest_doc(name="TestClass")to override name of element. It’ll override name based on the place it is being used (module, class or function).Note:pytest-docs uses the pytest collection mechanism, so your documentation will be generated according the the usual collection commands used to run the tests.What’s planned aheadSee if anyone is even interested in thisDocument fixturesDocument tests and fixtures parametrizationCustom formatters via hooksContributingContributions 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-docs” 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-docstyle
pytest-docstylepytestplugin to runpydocstyleInstallationpipinstallpytest-docstyleUsagepytest--pydocstyle...For detail, please seepytest -hafter installation.ConfigurationThe behavior can be configured in the same style of pydocstyle.(cf.Configuration — pytest documentationandConfiguration Files — pydocstyle documentation)For example,[pydocstyle]
convention = numpy
add-ignore = D400,D403

[tool:pytest]
addopts = --pydocstyleLicenceThe MIT LicenseCopyright (c) 2019 OMOTO TsukasaAcknowledgmentsabendebury/pytest-pep257