question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pytest does not respect ini values defined in conftest.py as validly defined

See original GitHub issue

Currently, any ini options added via pytest_addoption are flagged as unknown. They should be registered.

conftest.py:

gnikonorov:gleb_test [master] $ cat conftest.py
def pytest_addoption(parser):
    parser.addini("my_ini", "")
gnikonorov:gleb_test [master] $

pytest.ini:

gnikonorov:gleb_test [master] $ cat pytest.ini
[pytest]
my_ini=1
minversion = 3.0.0
gnikonorov:gleb_test [master] $
gnikonorov:gleb_test [master] $ pytest
WARNING: Unknown config ini key: my_ini
...
gnikonorov:gleb_test [master] $

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
The-Compilercommented, Oct 6, 2020

@vitvakatu When you go to a PR (#7384) and click the commit ID at the bottom (“nicoddemus merged commit 4cc4ebf into pytest-dev:master”), you can see which version that commit is in:

image

So this has been in 6.0.0 already, and I can’t reproduce the issue with the reproducer in the original post. If you’re still running into problems, please open a separate issue.

1reaction
gnikonorovcommented, Oct 6, 2020

No worries @vitvakatu!

Looks like @The-Compiler beat me to the answer. If you’re experiencing an issue it’s probably best to open a new issue like he mentioned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can conftest.py _read_ an existing value from pytest.ini?
I would like to look at the value of a parameter in pytest.ini and use it to set the default value of another...
Read more >
API Reference — pytest documentation
This problem is commonly encountered when writing tests, e.g. when making sure that floating-point values are what you expect them to be.
Read more >
pytest Documentation - Read the Docs
The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you under-.
Read more >
[WIP] How to create a modern pytest dev environment with ...
pycodestyleEnabled : enables the code style features. It shows alerts when you have something that does not respect the defined code style.
Read more >
10 Cool Pytest Tips You Might Not Know About - PyBites
Here are 10 things we learned writing pytest code that might come in ... Hint: make sure your test modules/packages have valid Python...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found