Answers for "pytest import module"

3

install pytest

pip install pytest
Posted by: Guest on July-24-2020
0

pytest local modules

import sys, os
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')

# from https://stackoverflow.com/questions/10253826/path-issue-with-pytest-importerror-no-module-named-yadayadayada
Posted by: Guest on March-28-2020
0

pytest

# content of conftest.py @by github -> linkerunk
import pytest


def pytest_addoption(parser):
    parser.addoption(
        "--cmdopt", action="store", default="type1", help="my option: type1 or type2"
    )


@pytest.fixture
def cmdopt(request):
    return request.config.getoption("--cmdopt")
Posted by: Guest on November-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language