This is a pytest plugin, that enables you to test your code that relies on a running MongoDB database

Overview

https://raw.githubusercontent.com/ClearcodeHQ/pytest-mongo/master/logo.png

pytest-mongo

Latest PyPI version Wheel Status Supported Python Versions License

What is this?

This is a pytest plugin, that enables you to test your code that relies on a running MongoDB database. It allows you to specify fixtures for MongoDB process and client.

How to use

Plugin contains two fixtures

  • mongodb - it's a client fixture that has functional scope, and which cleans MongoDB at the end of each test.
  • mongo_proc - session scoped fixture, that starts MongoDB instance at the first use and stops at the end of the tests.
  • mongo_noproc - a no process fixture, that's connecting to already running mongodb instance. For example on dockerized test environments, or CI providing mongodb services

Simply include one of these fixtures into your tests fixture list.

You can also create additional MongoDB client and process fixtures if you'd need to:

from pytest_mongo import factories

mongo_my_proc = factories.mongo_proc(
    port=None, logsdir='/tmp')
mongo_my = factories.mongodb('mongo_my_proc')

Note

Each MongoDB process fixture can be configured in a different way than the others through the fixture factory arguments.

Connecting to already existing mongodb database

Some projects are using already running MongoDB servers (ie on docker instances). In order to connect to them, one would be using the mongo_noproc fixture.

mongo_external = factories.mongodb('mongo_noproc')

By default the mongo_noproc fixture would connect to MongoDB instance using 27017 port. Standard configuration options apply to it.

These are the configuration options that are working on all levels with the mongo_noproc fixture:

Configuration

You can define your settings in three ways, it's fixture factory argument, command line option and pytest.ini configuration option. You can pick which you prefer, but remember that these settings are handled in the following order:

  • Fixture factory argument
  • Command line option
  • Configuration option in your pytest.ini file
Configuration options
MongoDB server option Fixture factory argument Command line option pytest.ini option Noop process fixture Default
Path to mongodb exec executable --mongo-exec mongo_exec no /usr/bin/mongod
MongoDB host host --mongo-host mongo_host 127.0.0.1 127.0.0.1
MongoDB port port --mongo-port port 27017 random
Path to store logs logsdir --mongo-logsdir mongo_logsdir no $TMPDIR
Additional parameters params --mongo-params mongo_params no  
MongoDB client's time zone awarness tz_aware --mongo-tz-aware mongo_tz_aware no False

Example usage:

  • pass it as an argument in your own fixture

    mongo_proc = factories.mongo_proc(port=8888)
  • use --mongo-port command line option when you run your tests

    py.test tests --mongo-port=8888
    
  • specify your directory as mongo_port in your pytest.ini file.

    To do so, put a line like the following under the [pytest] section of your pytest.ini:

    [pytest]
    mongo_port = 8888

Package resources

Comments
  • Bump port-for from 0.5.0 to 0.6.1

    Bump port-for from 0.5.0 to 0.6.1

    ⚠️ Dependabot Preview has been deactivated ⚠️

    This pull request was created by Dependabot Preview, and you've upgraded to Dependabot. This means it won't respond to dependabot commands nor will it be automatically closed if a new version is found.

    If you close this pull request, Dependabot will re-create it the next time it checks for updates and everything will work as expected.


    Bumps port-for from 0.5.0 to 0.6.1.

    Changelog

    Sourced from port-for's changelog.

    0.6.1

    Bugfix

    • Fixed typing definition for get_port function

    0.6.0

    Feature

    • Added get_port helper that can randomly select open port out of given set, or range-tuple
    • Added type annotations and compatibility with PEP 561
    • Support only python 3.7 and up
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request during working hours.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in the .dependabot/config.yml file in this repo:

    • Update frequency
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump port-for from 0.5.0 to 0.6.0

    Bump port-for from 0.5.0 to 0.6.0

    Bumps port-for from 0.5.0 to 0.6.0.

    Changelog

    Sourced from port-for's changelog.

    0.6.0

    Feature

    • Added get_port helper that can randomly select open port out of given set, or range-tuple
    • Added type annotations and compatibility with PEP 561
    • Support only python 3.7 and up
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request during working hours.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in the .dependabot/config.yml file in this repo:

    • Update frequency
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump mirakuru from 2.3.0 to 2.4.1

    Bump mirakuru from 2.3.0 to 2.4.1

    ⚠️ Dependabot Preview has been deactivated ⚠️

    This pull request was created by Dependabot Preview, and you've upgraded to Dependabot. This means it won't respond to dependabot commands nor will it be automatically closed if a new version is found.

    If you close this pull request, Dependabot will re-create it the next time it checks for updates and everything will work as expected.


    Bumps mirakuru from 2.3.0 to 2.4.1.

    Changelog

    Sourced from mirakuru's changelog.

    2.4.1

    Misc

    • Use strictier mypy checks

    2.4.0

    Features

    • Replace exp_sig executor parameter with expected_returncode. Parameter description already assumed that, however handing it assumed full POSIX compatibility on the process side. Now the POSIX is only assumed if no expected_returncode is passed to the executor, and returncode is simply that, a returncode, nothing more

    2.3.1

    Misc

    • Moved CI to Github Actions
    • Blackified codebase
    • Compacted Documentation into readme (was pretty small anyway)
    Commits
    • 02e108a "Release 2.4.1"
    • 4192d24 changes
    • 1cf1274 Merge pull request #464 from mmaslowskicc/stricter-mypy
    • eeb1c55 Use a stricter mypy configuration and annotate test functions
    • b28bcb8 Merge pull request #463 from mmaslowskicc/contributing
    • 54358ab Update CONTRIBUTING.rst as we are not using pylama
    • 8045efd "Release 2.4.0"
    • a6011e3 Fixed changes.rst header
    • 53fbbed Merge pull request #462 from ClearcodeHQ/dependabot/pip/pydocstyle-6.1.1
    • 06c1f1a Bump pydocstyle from 6.0.0 to 6.1.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request during working hours.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in the .dependabot/config.yml file in this repo:

    • Update frequency
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump mirakuru from 2.3.0 to 2.4.0

    Bump mirakuru from 2.3.0 to 2.4.0

    Bumps mirakuru from 2.3.0 to 2.4.0.

    Changelog

    Sourced from mirakuru's changelog.

    2.4.0

    Features

    • Replace exp_sig executor parameter with expected_returncode. Parameter description already assumed that, however handing it assumed full POSIX compatibility on the process side. Now the POSIX is only assumed if no expected_returncode is passed to the executor, and returncode is simply that, a returncode, nothing more

    2.3.1

    Misc

    • Moved CI to Github Actions
    • Blackified codebase
    • Compacted Documentation into readme (was pretty small anyway)
    Commits
    • 8045efd "Release 2.4.0"
    • a6011e3 Fixed changes.rst header
    • 53fbbed Merge pull request #462 from ClearcodeHQ/dependabot/pip/pydocstyle-6.1.1
    • 06c1f1a Bump pydocstyle from 6.0.0 to 6.1.1
    • 2615857 Merge pull request #461 from ClearcodeHQ/dependabot/pip/pytest-cov-2.12.0
    • b5f97e4 Bump pytest-cov from 2.11.1 to 2.12.0
    • ce05b78 Merge pull request #460 from languitar/patch-1
    • bed20cd Fix typo in changelog
    • fc556d0 Merge pull request #459 from ClearcodeHQ/issue-457
    • abc154b Replace exp_sig with expected_returncode - closes #457
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request during working hours.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in the .dependabot/config.yml file in this repo:

    • Update frequency
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump mirakuru from 2.3.0 to 2.3.1

    Bump mirakuru from 2.3.0 to 2.3.1

    Bumps mirakuru from 2.3.0 to 2.3.1.

    Changelog

    Sourced from mirakuru's changelog.

    2.3.1

    Misc

    • Moved CI to Github Actions
    • Blackified codebase
    • Compacted Documentation into readme (was pretty small anyway)
    Commits
    • 676cf00 "Release 2.3.1"
    • 4b5cb9f Updated bumpversion and cleanup readme badges
    • 8610e8c Merge pull request #455 from ClearcodeHQ/nodocs
    • 39a422c Move relevant docs to README, mention Windows Support - closes #453
    • 408781f Merge pull request #452 from fizyk/cfg
    • b9aef2a Define package in setup.cfg instead of setup.py
    • 6192691 Merge pull request #450 from ClearcodeHQ/dependabot/pip/black-21.5b0
    • 581f316 Update black github action
    • 7bf7176 Run test on pr always
    • 6601f9e Bump black from 21.4b2 to 21.5b0
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request during working hours.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in the .dependabot/config.yml file in this repo:

    • Update frequency
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump mirakuru from 2.3.0 to 2.4.1

    Bump mirakuru from 2.3.0 to 2.4.1

    Bumps mirakuru from 2.3.0 to 2.4.1.

    Changelog

    Sourced from mirakuru's changelog.

    2.4.1

    Misc ++++

    • Use strictier mypy checks

    2.4.0

    Features ++++++++

    • Replace exp_sig executor parameter with expected_returncode. Parameter description already assumed that, however handing it assumed full POSIX compatibility on the process side. Now the POSIX is only assumed if no expected_returncode is passed to the executor, and returncode is simply that, a returncode, nothing more

    2.3.1

    Misc ++++

    • Moved CI to Github Actions
    • Blackified codebase
    • Compacted Documentation into readme (was pretty small anyway)
    Commits
    • 02e108a "Release 2.4.1"
    • 4192d24 changes
    • 1cf1274 Merge pull request #464 from mmaslowskicc/stricter-mypy
    • eeb1c55 Use a stricter mypy configuration and annotate test functions
    • b28bcb8 Merge pull request #463 from mmaslowskicc/contributing
    • 54358ab Update CONTRIBUTING.rst as we are not using pylama
    • 8045efd "Release 2.4.0"
    • a6011e3 Fixed changes.rst header
    • 53fbbed Merge pull request #462 from ClearcodeHQ/dependabot/pip/pydocstyle-6.1.1
    • 06c1f1a Bump pydocstyle from 6.0.0 to 6.1.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 3
  • Bump port-for from 0.5.0 to 0.6.1

    Bump port-for from 0.5.0 to 0.6.1

    Bumps port-for from 0.5.0 to 0.6.1.

    Changelog

    Sourced from port-for's changelog.

    0.6.1

    Bugfix ++++++

    • Fixed typing definition for get_port function

    0.6.0

    Feature +++++++

    • Added get_port helper that can randomly select open port out of given set, or range-tuple
    • Added type annotations and compatibility with PEP 561
    • Support only python 3.7 and up
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 3
  • Bump coverage from 5.4 to 5.5

    Bump coverage from 5.4 to 5.5

    Bumps coverage from 5.4 to 5.5.

    Release notes

    Sourced from coverage's releases.

    coverage-5.5

    • coverage combine has a new option, --keep to keep the original data files after combining them. The default is still to delete the files after they have been combined. This was requested in issue 1108 and implemented in pull request 1110. Thanks, Éric Larivière.
    • When reporting missing branches in coverage report, branches aren’t reported that jump to missing lines. This adds to the long-standing behavior of not reporting branches from missing lines. Now branches are only reported if both the source and destination lines are executed. Closes both issue 1065 and issue 955.
    • Minor improvements to the HTML report:
      • The state of the line visibility selector buttons is saved in local storage so you don’t have to fiddle with them so often, fixing issue 1123.
      • It has a little more room for line numbers so that 4-digit numbers work well, fixing issue 1124.
    • Improved the error message when combining line and branch data, so that users will be more likely to understand what’s happening, closing issue 803.
    Changelog

    Sourced from coverage's changelog.

    Version 5.5 --- 2021-02-28

    • coverage combine has a new option, --keep to keep the original data files after combining them. The default is still to delete the files after they have been combined. This was requested in issue 1108 and implemented in pull request 1110. Thanks, Éric Larivière.
    • When reporting missing branches in coverage report, branches aren't reported that jump to missing lines. This adds to the long-standing behavior of not reporting branches from missing lines. Now branches are only reported if both the source and destination lines are executed. Closes both issue 1065 and issue 955.
    • Minor improvements to the HTML report:
      • The state of the line visibility selector buttons is saved in local storage so you don't have to fiddle with them so often, fixing issue 1123.
      • It has a little more room for line numbers so that 4-digit numbers work well, fixing issue 1124.
    • Improved the error message when combining line and branch data, so that users will be more likely to understand what's happening, closing issue 803.
    Commits
    • f06b950 docs: use sphinxcontrib for the rst builder
    • 4432122 build: a better kit-building link
    • 9e8010c build: version 5.5 prep
    • c842085 doc: latest sample HTML report
    • 79087b9 fix: don't report branches to missing lines. #1065
    • b12f189 test: fix a few metacov exclusions
    • fd78a6d docs: correct the GitHub action badges
    • 1699725 fix: improve an error message. #803
    • 3f38567 build: coverage ci should fail fast
    • f5d6043 refactor: remove unused exception handling
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request during working hours.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in the .dependabot/config.yml file in this repo:

    • Update frequency
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 3
  • Bump pycodestyle from 2.9.1 to 2.10.0

    Bump pycodestyle from 2.9.1 to 2.10.0

    Bumps pycodestyle from 2.9.1 to 2.10.0.

    Changelog

    Sourced from pycodestyle's changelog.

    2.10.0 (2022-11-23)

    Changes:

    • E231: allow trailing comma inside 1-tuples in []. PR #1108.
    • W601, W602, W603, W604: removed (no longer relevant in python 3). PR #1111.
    • E741: also apply to lambdas. PR #1106.
    • E741: fix false positive for comparison operators. PR #1118.
    Commits
    • 1063db8 Merge pull request #1125 from PyCQA/2_10_0
    • 806bf5c Release 2.10.0
    • b388782 Merge pull request #1123 from PyCQA/fix-E741-again
    • 7498309 Merge pull request #1124 from PyCQA/py2-cruft
    • 798d620 fix ambiguous identifiers in lambda bodies inside braces
    • 956ab1f remove some leftover python 2 compat
    • c5308a7 Merge pull request #1122 from PyCQA/stop-E741-after-parameters
    • 56dac13 fix reporting of ambiguous identifier after parameter list
    • 6cac99d Merge pull request #1119 from PyCQA/pre-commit-ci-update-config
    • 1094676 [pre-commit.ci] pre-commit autoupdate
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 1
  • Bump pymongo from 4.3.2 to 4.3.3

    Bump pymongo from 4.3.2 to 4.3.3

    Bumps pymongo from 4.3.2 to 4.3.3.

    Release notes

    Sourced from pymongo's releases.

    PyMongo 4.3.3

    Release notes: https://www.mongodb.com/community/forums/t/pymongo-4-3-3-release/200145

    Changelog

    Sourced from pymongo's changelog.

    Changes in Version 4.3.3

    Version 4.3.3 documents support for the following:

    • :ref:CSFLE on-demand credentials for cloud KMS providers.
    • Authentication support for :ref:EKS Clusters.
    • Added the :ref:timeout-example example page to improve the documentation for :func:pymongo.timeout.

    Bug Fixes .........

    • Fixed a performance regression in :meth:~gridfs.GridFSBucket.download_to_stream and :meth:~gridfs.GridFSBucket.download_to_stream_by_name by reading in chunks instead of line by line (PYTHON-3502_).
    • Improved performance of :meth:gridfs.grid_file.GridOut.read and :meth:gridfs.grid_file.GridOut.readline (PYTHON-3508_).

    Issues Resolved ...............

    See the PyMongo 4.3.3 release notes in JIRA_ for the list of resolved issues in this release.

    .. _PYTHON-3502: https://jira.mongodb.org/browse/PYTHON-3502 .. _PYTHON-3508: https://jira.mongodb.org/browse/PYTHON-3508 .. _PyMongo 4.3.3 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=34709

    Commits
    • 3d03276 BUMP 4.3.3
    • 1edbfad PYTHON-3529 Improve reliability of test_list_databases (#1120)
    • cde9adf PYTHON-3527 + PYTHON-3528 Fix no-server tests (#1118)
    • b290f7b PYTHON-3526 Fix mockup tests (#1119)
    • 3ab7390 PYTHON-3500 Resync retryable tests to fix serverless failures (#1116)
    • 363e0b2 PYTHON-2818 Add documentation and changelog (#1115)
    • 79aa5e6 PYTHON-3516 Improve test EventListener api (#1114)
    • d056804 PYTHON-2818 Add native support for AWS IAM Roles for service accounts, EKS in...
    • fcb1151 PYTHON-3517 Add documentation for on-demand KMS providers (#1113)
    • 92e6150 PYTHON-3493 Bulk Write InsertOne Should Be Parameter Of Collection Type (#1106)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 0
  • Allow defining port (and maybe other configuration) at runtime

    Allow defining port (and maybe other configuration) at runtime

    Hi there,

    I have a use case where I will only know the port to a running instance of mongo at runtime (and I'm able to get that via a session-scoped fixture). I would like to be able to tell pytest-mongo to use such a port. By looking at the documentation, it seems that there isn't a supported way of passing the port (or other configuration) to pytest-mongo at runtime. That would really be useful.

    A way I can think of providing such a feature is to allow users to override a fixture that will give the configuration necessary. For example:

    @pyest.fixture(scope='session')
    def pytest_mongo_conf(my, own, required, fixtures, here):
        ... # Get host and port from other fixtures
        # Options defined in the returned dictionary would override their previous (or default) values
        return {
            'host': host,
            'port': port,
        }
    
    Accepting pullrequests documentation 
    opened by guludo 5
  • Option to start DB as single-member replica set

    Option to start DB as single-member replica set

    Some MongoDB features such as change streams do not work with standalone instances. In that case a replica set is required. It would be nice if there was an option to start a database as a single-member replica set for being able to use change streams, transactions etc. also in tests.

    Here is workaround that I am currently using in most affected projects. As this is required more often, it would be nice if this was part of the pytest-plugin itself:

    @pytest.fixture(scope="session")
    def mongo_repl_proc(mongo_proc):
        client = pymongo.MongoClient(f"mongodb://{mongo_proc.host}:{mongo_proc.port}")
        client.admin.command("replSetInitiate")
        time.sleep(1)
        return mongo_proc
    
    
    @pytest.fixture
    def mongo(mongo_repl_proc):  # noqa: CCR001
        """
        Provide an empty mongodb client.
    
        This is a modification of the fixture from pytest-mongo to support replica
        sets. These require returning a client that specifically knows about them.
        """
        client = pymongo.MongoClient(
            f"mongodb://{mongo_repl_proc.host}:{mongo_repl_proc.port}",
            replicaset="rep0",
            tz_aware=True,
            # Ensures that write operations in tests are always visible to subsequent reads
            # without using explicit sessions.
            journal=True,
        )
    
        # wait for nodes
        while not client.nodes:
            time.sleep(0.1)
    
        yield client
    
        # clean the database
        for db_name in client.list_database_names():
            if db_name == "config":
                continue
            database = client[db_name]
            for collection_name in database.list_collection_names():
                collection = database[collection_name]
                # Do not delete any of Mongo system collections
                if (
                    collection.name.startswith("system.")
                    or collection.name.startswith("oplog.")
                    or collection.name.startswith("replset.")
                ):
                    continue
                collection.drop()
    

    An in pytest.ini:

    mongo_params = --replSet rep0
    
    enhancement help wanted Accepting pullrequests 
    opened by languitar 0
Owner
Clearcode
Software house with a passion for technology. We specialize in building enterprise-grade adtech, martech and analytics platforms.
Clearcode
A pytest plugin that enables you to test your code that relies on a running Elasticsearch search engine

pytest-elasticsearch What is this? This is a pytest plugin that enables you to test your code that relies on a running Elasticsearch search engine. It

Clearcode 65 Nov 10, 2022
pytest plugin providing a function to check if pytest is running.

pytest-is-running pytest plugin providing a function to check if pytest is running. Installation Install with: python -m pip install pytest-is-running

Adam Johnson 21 Nov 1, 2022
Pytest-typechecker - Pytest plugin to test how type checkers respond to code

pytest-typechecker this is a plugin for pytest that allows you to create tests t

vivax 2 Aug 20, 2022
A pytest plugin to run an ansible collection's unit tests with pytest.

pytest-ansible-units An experimental pytest plugin to run an ansible collection's unit tests with pytest. Description pytest-ansible-units is a pytest

Community managed Ansible repositories 9 Dec 9, 2022
pytest plugin that let you automate actions and assertions with test metrics reporting executing plain YAML files

pytest-play pytest-play is a codeless, generic, pluggable and extensible automation tool, not necessarily test automation only, based on the fantastic

pytest-dev 67 Dec 1, 2022
pytest plugin for manipulating test data directories and files

pytest-datadir pytest plugin for manipulating test data directories and files. Usage pytest-datadir will look up for a directory with the name of your

Gabriel Reis 191 Dec 21, 2022
pytest plugin for a better developer experience when working with the PyTorch test suite

pytest-pytorch What is it? pytest-pytorch is a lightweight pytest-plugin that enhances the developer experience when working with the PyTorch test sui

Quansight 39 Nov 18, 2022
ApiPy was created for api testing with Python pytest framework which has also requests, assertpy and pytest-html-reporter libraries.

ApiPy was created for api testing with Python pytest framework which has also requests, assertpy and pytest-html-reporter libraries. With this f

Mustafa 1 Jul 11, 2022
Playwright Python tool practice pytest pytest-bdd screen-play page-object allure cucumber-report

pytest-ui-automatic Playwright Python tool practice pytest pytest-bdd screen-play page-object allure cucumber-report How to run Run tests execute_test

moyu6027 11 Nov 8, 2022
Pytest-rich - Pytest + rich integration (proof of concept)

pytest-rich Leverage rich for richer test session output. This plugin is not pub

Bruno Oliveira 170 Dec 2, 2022
Set your Dynaconf environment to testing when running pytest

pytest-dynaconf Set your Dynaconf environment to testing when running pytest. Installation You can install "pytest-dynaconf" via pip from PyPI: $ pip

David Baumgold 3 Mar 11, 2022
a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)

pytest-sugar pytest-sugar is a plugin for pytest that shows failures and errors instantly and shows a progress bar. Requirements You will need the fol

Teemu 963 Dec 28, 2022
A set of pytest fixtures to test Flask applications

pytest-flask An extension of pytest test runner which provides a set of useful tools to simplify testing and development of the Flask extensions and a

pytest-dev 433 Dec 23, 2022
Selects tests affected by changed files. Continous test runner when used with pytest-watch.

This is a pytest plug-in which automatically selects and re-executes only tests affected by recent changes. How is this possible in dynamic language l

Tibor Arpas 614 Dec 30, 2022
Local continuous test runner with pytest and watchdog.

pytest-watch -- Continuous pytest runner pytest-watch a zero-config CLI tool that runs pytest, and re-runs it when a file in your project changes. It

Joe Esposito 675 Dec 23, 2022
A set of pytest fixtures to test Flask applications

pytest-flask An extension of pytest test runner which provides a set of useful tools to simplify testing and development of the Flask extensions and a

pytest-dev 354 Feb 17, 2021
API Test Automation with Requests and Pytest

api-testing-requests-pytest Install Make sure you have Python 3 installed on your machine. Then: 1.Install pipenv sudo apt-get install pipenv 2.Go to

Sulaiman Haque 2 Nov 21, 2021
a wrapper around pytest for executing tests to look for test flakiness and runtime regression

bubblewrap a wrapper around pytest for assessing flakiness and runtime regressions a cs implementations practice project How to Run: First, install de

Anna Nagy 1 Aug 5, 2021
Front End Test Automation with Pytest Framework

Front End Test Automation Framework with Pytest Installation and running instructions: 1. To install the framework on your local machine: clone the re

Sergey Kolokolov 2 Jun 17, 2022