deliverr-pytest
v0.1.6
Published
Common pytest fixtures
Downloads
4
Readme
Common pytest
fixtures
Use
Install
To avoid configuring private PyPI registry, this project is distributed via npm
:
npm i -D deliverr-pytest
pip requirements.txt
:
echo '--find-links node_modules/deliverr-pytest' >> requirements.txt
echo 'deliverr-pytest' >> requirements.txt
pip install -r requirements.txt
pipenv
:
pipenv install --dev node_modules/deliverr-pytest/deliverr_pytest-0.1.0-py3-none-any.whl
poetry
:
poetry add --dev node_modules/deliverr-pytest/deliverr_pytest-0.1.0-py3-none-any.whl
Available Fixtures
test_output: TestOutput
Capturing files:
from deliverr_pytest import TestOutput
def test(test_output: TestOutput):
...
test_output.capture(file_name_1).write(output_1)
test_output.capture(file_name_2).write(output_2)
test_output.assert_expected()
Capturing requests_mock
requests:
import requests
import requests_mock
from deliverr_pytest import TestOutput
def test(test_output: TestOutput, requests_mock: requests_mock.Mocker):
...
requests_mock.get("https://httpbin.org/get", text="data")
assert "data" == requests.get("https://httpbin.org/get").text
test_output.capture_requests(requests_mock)
test_output.assert_expected()
test_output: TestOutput
Develop
See CONTRIBUTE