<div dir="ltr">Hi Skip,<div><br></div><div class="gmail_quote"><div dir="ltr">On Tue, May 1, 2018 at 10:56 AM Skip Montanaro &lt;<a href="mailto:skip.montanaro@gmail.com">skip.montanaro@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;m moving from nose to pytest and am struggling a bit to get a<br>
working/useful config file. I renamed .noserc to pytest.ini and didn&#39;t<br>
change anything. Things seemed to work okay, but various bits of<br>
functionality are missing (output&#39;s not verbose, doctests aren&#39;t run,<br>
xunit/junit output not generated). I was a bit worried that it was ignoring<br>
my config file (even though it reports finding it).<br>
<br>
Here&#39;s one basic example. When I use --verbose on the command line, I get<br>
the expected verbose output, one line per test. If I give<br>
<br>
[pytest]<br>
verbose=yes<br>
<br>
in the ini file, I get no verbose output, just the one dot per test. I also<br>
tried  verbosity=1 and verbosity=2 to no avail. In addition, none of those<br>
three settings provoked an error message from pytest. Pytest never<br>
complains about anything. It seems to silently ignore everything.<br>
<br>
In general, it&#39;s not clear how I do the following:<br>
<br>
1. Translate old .noserc settings into pytest-speak<br>
<br>
2. Move settings off the command line into the config file. (I see the<br>
addopts thing, but aren&#39;t there equivalent configuration settings for the<br>
command line flags?)<br></blockquote><div><br></div><div>You are correct, the proper way is to use `addopts` to always pass some options to pytest as if they were typed in the command line. From that you said at the start it seems this is a good start:</div><div><br></div><div>[pytest]</div><div>addopts = -v --doctest-modules --junitxml=tests.xml</div><div><br></div><div>As a rule pytest doesn&#39;t mimic all command-line options as a separate ini setting, as it seems to be the case with nose.</div><div><br></div><div>You can see all ini settings in the reference docs: <a href="https://docs.pytest.org/en/latest/reference.html#configuration-options">https://docs.pytest.org/en/latest/reference.html#configuration-options</a></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Google failed me. I saw some blog posts about converting from nose to<br>
pytest, but didn&#39;t see any discussion about the translation of<br>
configuration settings. Does pytest have some kind of magic<br>
&quot;--generate-config&quot; flag which will spit out a pytest.ini file with all the<br>
default values?<br></blockquote><div><br></div><div>It doesn&#39;t currently, but I think such a flag could indeed be useful.</div><div><br></div><div>Right now it also doesn&#39;t display any message about unknown settings; I think that is because since plugins can add new config settings, it might happen that an user doesn&#39;t have a plugin installed but their pytest.ini contains settings which are added by the missing plugin, so issuing an error in that situation would be a problem. But a warning surely would be welcome instead.</div><div><br></div><div>Cheers,</div><div>Bruno.</div></div></div>