pytest-lazy-fixture


Namepytest-lazy-fixture JSON
Version 0.6.3 PyPI version JSON
download
home_pagehttps://github.com/tvorog/pytest-lazy-fixture
SummaryIt helps to use fixtures in pytest.mark.parametrize
upload_time2020-02-01 18:04:02
maintainerMarsel Zaripov
docs_urlNone
authorMarsel Zaripov
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements None tox flake8
Travis-CI
coveralls test coverage No coveralls.
            pytest-lazy-fixture |travis-ci| |appveyor| |pypi|
=================================================

Use your fixtures in ``@pytest.mark.parametrize``.

Installation
------------

.. code-block:: shell

    pip install pytest-lazy-fixture

Usage
-----

.. code-block:: python

    import pytest

    @pytest.fixture(params=[1, 2])
    def one(request):
        return request.param

    @pytest.mark.parametrize('arg1,arg2', [
        ('val1', pytest.lazy_fixture('one')),
    ])
    def test_func(arg1, arg2):
        assert arg2 in [1, 2]


Also you can use it as a parameter in ``@pytest.fixture``:

.. code-block:: python

    import pytest

    @pytest.fixture(params=[
        pytest.lazy_fixture('one'),
        pytest.lazy_fixture('two')
    ])
    def some(request):
        return request.param

    @pytest.fixture
    def one():
        return 1

    @pytest.fixture
    def two():
        return 2

    def test_func(some):
        assert some in [1, 2]

Please see `tests <https://github.com/TvoroG/pytest-lazy-fixture/blob/master/tests/test_lazyfixture.py>`_ for more examples.

Contributing
------------

Contributions are very welcome. Tests can be run with ``tox``.

License
-------

Distributed under the terms of the ``MIT`` license,
``pytest-lazy-fixture`` is free and open source software

Issues
------

If you encounter any problems, please ``file an issue`` along with a
detailed description.

.. |travis-ci| image:: https://travis-ci.org/TvoroG/pytest-lazy-fixture.svg?branch=master
    :target: https://travis-ci.org/TvoroG/pytest-lazy-fixture
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/TvoroG/pytest-fixture-mark?branch=master&svg=true
    :target: https://ci.appveyor.com/project/TvoroG/pytest-fixture-mark
.. |pypi| image:: https://badge.fury.io/py/pytest-lazy-fixture.svg
    :target: https://pypi.python.org/pypi/pytest-lazy-fixture/



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tvorog/pytest-lazy-fixture",
    "name": "pytest-lazy-fixture",
    "maintainer": "Marsel Zaripov",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "marszaripov@gmail.com",
    "keywords": "",
    "author": "Marsel Zaripov",
    "author_email": "marszaripov@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/82/ae6d2f6903719c4ec410dcd31ee24e3bce74b2cef3c5b9150ad36e8594b6/pytest-lazy-fixture-0.6.3.tar.gz",
    "platform": "",
    "description": "pytest-lazy-fixture |travis-ci| |appveyor| |pypi|\n=================================================\n\nUse your fixtures in ``@pytest.mark.parametrize``.\n\nInstallation\n------------\n\n.. code-block:: shell\n\n    pip install pytest-lazy-fixture\n\nUsage\n-----\n\n.. code-block:: python\n\n    import pytest\n\n    @pytest.fixture(params=[1, 2])\n    def one(request):\n        return request.param\n\n    @pytest.mark.parametrize('arg1,arg2', [\n        ('val1', pytest.lazy_fixture('one')),\n    ])\n    def test_func(arg1, arg2):\n        assert arg2 in [1, 2]\n\n\nAlso you can use it as a parameter in ``@pytest.fixture``:\n\n.. code-block:: python\n\n    import pytest\n\n    @pytest.fixture(params=[\n        pytest.lazy_fixture('one'),\n        pytest.lazy_fixture('two')\n    ])\n    def some(request):\n        return request.param\n\n    @pytest.fixture\n    def one():\n        return 1\n\n    @pytest.fixture\n    def two():\n        return 2\n\n    def test_func(some):\n        assert some in [1, 2]\n\nPlease see `tests <https://github.com/TvoroG/pytest-lazy-fixture/blob/master/tests/test_lazyfixture.py>`_ for more examples.\n\nContributing\n------------\n\nContributions are very welcome. Tests can be run with ``tox``.\n\nLicense\n-------\n\nDistributed under the terms of the ``MIT`` license,\n``pytest-lazy-fixture`` is free and open source software\n\nIssues\n------\n\nIf you encounter any problems, please ``file an issue`` along with a\ndetailed description.\n\n.. |travis-ci| image:: https://travis-ci.org/TvoroG/pytest-lazy-fixture.svg?branch=master\n    :target: https://travis-ci.org/TvoroG/pytest-lazy-fixture\n.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/TvoroG/pytest-fixture-mark?branch=master&svg=true\n    :target: https://ci.appveyor.com/project/TvoroG/pytest-fixture-mark\n.. |pypi| image:: https://badge.fury.io/py/pytest-lazy-fixture.svg\n    :target: https://pypi.python.org/pypi/pytest-lazy-fixture/\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "It helps to use fixtures in pytest.mark.parametrize",
    "version": "0.6.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "d4cc73680f20630f471965e4cc40694a",
                "sha256": "e0b379f38299ff27a653f03eaa69b08a6fd4484e46fd1c9907d984b9f9daeda6"
            },
            "downloads": -1,
            "filename": "pytest_lazy_fixture-0.6.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d4cc73680f20630f471965e4cc40694a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4948,
            "upload_time": "2020-02-01T18:04:00",
            "upload_time_iso_8601": "2020-02-01T18:04:00.347893Z",
            "url": "https://files.pythonhosted.org/packages/2d/a1/2f2c1c2353350d66c4d110d283e422e4943eb5ad10effa9357ba66f7b5b9/pytest_lazy_fixture-0.6.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "d58a9fbd0ccee6903d8e2cce2b4c9e19",
                "sha256": "0e7d0c7f74ba33e6e80905e9bfd81f9d15ef9a790de97993e34213deb5ad10ac"
            },
            "downloads": -1,
            "filename": "pytest-lazy-fixture-0.6.3.tar.gz",
            "has_sig": false,
            "md5_digest": "d58a9fbd0ccee6903d8e2cce2b4c9e19",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7878,
            "upload_time": "2020-02-01T18:04:02",
            "upload_time_iso_8601": "2020-02-01T18:04:02.321563Z",
            "url": "https://files.pythonhosted.org/packages/b2/82/ae6d2f6903719c4ec410dcd31ee24e3bce74b2cef3c5b9150ad36e8594b6/pytest-lazy-fixture-0.6.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-02-01 18:04:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "tvorog",
    "github_project": "pytest-lazy-fixture",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "appveyor": true,
    "requirements": [
        {
            "name": null,
            "specs": []
        },
        {
            "name": "tox",
            "specs": []
        },
        {
            "name": "flake8",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "pytest-lazy-fixture"
}
        
Elapsed time: 0.04452s