<div dir="ltr"><br><div>I&#39;ve managed to get Pytest to run my test file. </div><div><br></div><div>I then thought I would run Pytest with Coverage from within Pycharm (because I couldn&#39;t find the information on how to run pytest &amp; coverage at the same time, from the command line. The docs on this are somewhat vague.). </div><div><br>Within Pycharm, you can tell Pytest exactly where to run, if you want to focus on a specific test or test directory. However, there doesn&#39;t appear to be an option to tell Pycharm to run coverage to run from the same directory as the test file.</div><div><br></div><div>The file being tested is fairly short (about 20 lines). The test file I&#39;ve written is also fairly short, about 20-25 lines across 3 test functions. I&#39;m expecting that my tests are covering a fairly high percentage of the file being tested. Running coverage from Pycharm shows this: 6% files, 84% lines covered.<br><br>The 6% comes to me as a surprise since I&#39;m only testing 1 file with 1 test file.</div><div>Looking into the coverage docs, it looks like that I can tell coverage where to un, include, and exclude using .coveragerc. So I&#39;ve added a specific path to the directory where my test file is. Nothing changes in the coverage results.</div><div><br></div><div>I then tried running coverage from the command line, and am seeing an entirely different set of coverage statistics.<br></div><div><br></div><div>----------- coverage: platform win32, python 3.6.6-final-0 -----------<br>Name                                Stmts   Miss  Cover<br>-------------------------------------------------------<br>unit_tests\logfile.py                  37      7    81%<br>unit_tests\never_stops_running.py       7      7     0%<br>unit_tests\test_popen.py               29      0   100%<br>-------------------------------------------------------<br>TOTAL                                  73     14    81%<br></div><div><br></div><div><br></div><div><b>My questions:</b></div><div>1. What needs to change so that I get the same results when running Coverage from the command line and within Pycharm?<br></div><div>2. When running Coverage from Pycharm is there a way to tell coverage to show me which lines are not being tested?</div><div>3. Does anyone else feel that PyCharm should have a dialog that allows the user to point it to which code to measure coverage on? The Run/Debug dialog gives the user control over where to run Pytest, so why not coverage too?</div><div><br></div><div>thanks</div><div><br></div><div><br></div></div>