Skip to content

Pytest cannot be run using the custom command in the mian method #290

@longweiqiang

Description

@longweiqiang

conftest.py

import pytest
from simple_settings import settings

def pytest_addoption(parser):
    parser.addoption('--settings',
                     action='store',
                     default='config.env_qa')

test.py

import pytest
from simple_settings import settings

@pytest.mark.httptest_p0
class TestBotJobCase(TestBase):

    @pytest.mark.parametrize("args", data_item, ids=id_item)
    def test_bot_get_job_case(self, args):
        res = HttpUtils.http_get(self.headers, settings.JOB_BASE_URL+self.url_path, args['params'])

run.py

import pytest

if __name__ == '__main__':
    pytest.main(['--settings=config.env_qa', "-m", "httptest_p0", "--html=./testoutput/report.html"])

Errors

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions