Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We neither merge nor error when PYTEST_ADDOPTS is specified in user config. #16601

Closed
jsirois opened this issue Aug 22, 2022 · 1 comment · Fixed by #16614
Closed

We neither merge nor error when PYTEST_ADDOPTS is specified in user config. #16601

jsirois opened this issue Aug 22, 2022 · 1 comment · Fixed by #16614
Assignees
Labels
backend: Python Python backend-related issues bug

Comments

@jsirois
Copy link
Contributor

jsirois commented Aug 22, 2022

A user found when they ran certain tests, this was logged:

[WARN] Failed to generate JUnit XML data for test/python/...

Those tests have a BUILD of:

python_tests(
    name="tests",
    dependencies=[
        "3rdparty/python:nautobot-plugin-reqs",
        "3rdparty/python:reqs#pytest-django",
        "src/python/nautobot_animal_sounds",
        "src/python/netops_nautobot",
        "src/python/pytest_nautobot",
    ],
    extra_env_vars=[
        "DJANGO_SETTINGS_MODULE=nautobot.core.tests.nautobot_config",
        "NAUTOBOT_CONFIG=./src/python/netops_nautobot/nautobot_config.py",
        "NAUTOBOT_REDIS_PASSWORD=decinablesprewad",
        "PYTEST_ADDOPTS=-p pytest_nautobot --reuse-db",
    ],
    sources=["**/test_*.py"],
)

And we do not guard against PYTEST_ADDOPTS being set by the user; so our communication channel with pytest is stomped:

extra_env = {
"PYTEST_ADDOPTS": " ".join(add_opts),
"PEX_EXTRA_SYS_PATH": ":".join(prepared_sources.source_roots),
**test_extra_env.env,
# NOTE: field_set_extra_env intentionally after `test_extra_env` to allow overriding within
# `python_tests`.
**field_set_extra_env,
}

@jsirois jsirois added bug backend: Python Python backend-related issues labels Aug 22, 2022
@erjac77
Copy link
Contributor

erjac77 commented Aug 22, 2022

I'm on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Python Python backend-related issues bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants