
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
.. image:: https://raw.githubusercontent.com/dbfixtures/pytest-mongo/master/logo.png :width: 100px :height: 100px
.. image:: https://img.shields.io/pypi/v/pytest-mongo.svg :target: https://pypi.python.org/pypi/pytest-mongo/ :alt: Latest PyPI version
.. image:: https://img.shields.io/pypi/wheel/pytest-mongo.svg :target: https://pypi.python.org/pypi/pytest-mongo/ :alt: Wheel Status
.. image:: https://img.shields.io/pypi/pyversions/pytest-mongo.svg :target: https://pypi.python.org/pypi/pytest-mongo/ :alt: Supported Python Versions
.. image:: https://img.shields.io/pypi/l/pytest-mongo.svg :target: https://pypi.python.org/pypi/pytest-mongo/ :alt: License
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.
Plugin contains two fixtures
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:
.. code-block:: python
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.
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.
.. code-block:: python
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:
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``
.. list-table:: Configuration options :header-rows: 1
Example usage:
pass it as an argument in your own fixture
.. code-block:: python
mongo_proc = factories.mongo_proc(port=8888)
use --mongo-port
command line option when you run your tests
.. code-block:: sh
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
:
.. code-block:: ini
[pytest]
mongo_port = 8888
FAQs
MongoDB process and client fixtures plugin for Pytest.
We found that pytest-mongo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.