<div dir="ltr"><div class="markdown-here-wrapper" id="markdown-here-wrapper-202212" style><p style="margin:1.2em 0px!important">Hi Daniel,</p>
<p style="margin:1.2em 0px!important">The excellent pytest documentation has a <a href="http://pytest.org/latest/goodpractises.html#integration-with-setuptools-test-commands">section on Setuptools integration</a>. In that example, you would want to write instead: </p>


<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code class="language-python" style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline;white-space:pre;overflow:auto;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block;padding:0.5em;color:rgb(51,51,51);background-color:rgb(248,248,255);background-repeat:initial initial"><span class="comment" style="color:rgb(153,153,136);font-style:italic"># ...</span>
self.test_args = [<span class="string" style="color:rgb(221,17,68)">&#39;--flakes&#39;</span>]
<span class="comment" style="color:rgb(153,153,136);font-style:italic"># ...</span></code></pre>
<p style="margin:1.2em 0px!important">These arguments get passed to <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">pytest.main()</code>, which is the key to running pytest through Python. </p>


<p style="margin:1.2em 0px!important">The one thing I never loved about these plugins (along with the pytest PEP8 plugin) is that they only check files that are discovered. If you want to check your code as well as your test files, you have to run pytest <em>on your source tree too</em>. That never felt right to me. In addition, I had generated Python files that I didn’t want to syntax check. My solution was to <a href="https://github.com/seanfisk/python-project-template/blob/master/pavement.py.tpl#L173">run flake8 on all files reported as tracked</a> by my version control system. <strong>[Disclaimer: self-promotion]</strong> This is integrated into my <a href="https://github.com/seanfisk/python-project-template">Python Project Template</a>. It uses Paver instead of Setuptools for calling pytest, so it might be too heavyweight for your needs.</p>


<p style="margin:1.2em 0px!important">Either way, I hope this helps!</p>
</div><div></div><div></div><div></div></div><div class="gmail_extra"><br clear="all"><div><div><br></div><div>--</div><div>Sean Fisk</div></div>
<br><br><div class="gmail_quote">On Tue, Nov 26, 2013 at 8:57 PM, Daniel Farina <span dir="ltr">&lt;<a href="mailto:daniel@heroku.com" target="_blank">daniel@heroku.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hello,<br>
<br>
I would like to support &quot;python setup.py test&quot; to allow people to more<br>
easily get started with a project I work on.  I use pytest, which<br>
supports a large collection of options, and my scrying on the Internet<br>
fails to produce a way to support simply passing these through to<br>
pytest to interpret.<br>
<br>
For example, let&#39;s say I normally I run something like this:<br>
<br>
    py.test --flakes<br>
<br>
This works fine.<br>
<br>
But suppose I try to enable precisely this same thing via &quot;python<br>
setup.py test --flakes&quot;, then I receive:<br>
<br>
&quot;error: option --flakes not recognized&quot;<br>
<br>
It&#39;s not entirely clear to me when these option checks occur and how I<br>
could accept all options and delegate their handling (and error<br>
messages) to pytest.<br>
<br>
Thanks in advance for any advice one can offer.<br>
<br>
_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
</blockquote></div><br></div>