You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>So to run the tests you just need to run <codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">test</span></code>, etc…</p>
<dt><codeclass="docutils literal notranslate"><spanclass="pre">tortoise/contrib/</span></code>:</dt><dd><p>Anything that helps people use the project, such as Testing framework and linter plugins</p>
662
662
</dd>
663
-
<dt><codeclass="docutils literal notranslate"><spanclass="pre">tortoise/tests/</span></code>:</dt><dd><p>The Tortoise test code</p>
663
+
<dt><codeclass="docutils literal notranslate"><spanclass="pre">tests/</span></code>:</dt><dd><p>The Tortoise test code</p>
664
664
</dd>
665
665
</dl>
666
666
<h2id="coding-guideline">Coding Guideline<aclass="headerlink" href="#coding-guideline" title="Link to this heading">¶</a></h2>
@@ -711,14 +711,13 @@ <h3 id="different-types-of-tests">Different types of tests<a class="headerlink"
711
711
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">test_mysql</span></code>: Runs the tests on the mysql database</p></li>
712
712
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">testall</span></code>: runs the tests on all 4 database types: sqlite (in memory), postgresql, MySQL-MyISAM and MySQL-InnoDB</p></li>
713
713
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">green</span></code>: runs the same tests as <codeclass="docutils literal notranslate"><spanclass="pre">make</span><spanclass="pre">test</span></code>, ensures the green plugin works</p></li>
714
-
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">nose2</span><spanclass="pre">--plugin</span><spanclass="pre">tortoise.contrib.test.nose2</span><spanclass="pre">--db-module</span><spanclass="pre">tests.testmodels</span><spanclass="pre">--db-url</span><spanclass="pre">sqlite://:memory:</span><spanclass="pre">``:</span><spanclass="pre">same</span><spanclass="pre">test</span><spanclass="pre">as</span><spanclass="pre">``make</span><spanclass="pre">test</span></code> , ensures the nose2 plugin works</p></li>
715
714
</ul>
716
715
<h3id="things-to-be-aware-of-when-running-the-test-suite">Things to be aware of when running the test suite<aclass="headerlink" href="#things-to-be-aware-of-when-running-the-test-suite" title="Link to this heading">¶</a></h3>
717
716
<ulclass="simple">
718
717
<li><p>Some tests always run regardless of what test suite you are running (the connection tests for mysql and postgres for example, you don’t need a database running as it doesn’t actually connect though)</p></li>
719
718
<li><p>Some tests use hardcoded databases (usually sqlite) for testing, regardless of what DB url you specified.</p></li>
720
719
<li><p>The postgres driver does not work under Pypy so those tests will be skipped if you are running under pypy</p></li>
721
-
<li><p>You can run only specific tests by running `` py.test <testfiles>`` or <codeclass="docutils literal notranslate"><spanclass="pre">green</span><spanclass="pre">-s</span><spanclass="pre">1</span><spanclass="pre"><testfile></span></code></p></li>
720
+
<li><p>You can run only specific tests by running <codeclass="docutils literal notranslate"><spanclass="pre">pytest</span><spanclass="pre"><testfiles></span></code> or <codeclass="docutils literal notranslate"><spanclass="pre">green</span><spanclass="pre">-s</span><spanclass="pre">1</span><spanclass="pre"><testfile></span></code></p></li>
722
721
<li><dlclass="simple">
723
722
<dt>If you want a peek under the hood of test that hang to debug try running them with <codeclass="docutils literal notranslate"><spanclass="pre">green</span><spanclass="pre">-s</span><spanclass="pre">1</span><spanclass="pre">-vv</span><spanclass="pre">-d</span><spanclass="pre">-a</span><spanclass="pre"><test></span></code></dt><dd><ul>
724
723
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">-s</span><spanclass="pre">1</span></code> means it only runs one test at a time</p></li>
<spanclass="k">raise</span><spanclass="n">ConfigurationError</span><spanclass="p">(</span><spanclass="s1">'You must specify "db_url" and "modules" together'</span><spanclass="p">)</span>
<spanclass="k">assert</span><spanclass="n">config</span><spanclass="ow">is</span><spanclass="ow">not</span><spanclass="kc">None</span><spanclass="c1"># To improve type hints</span>
<spanclass="k">raise</span><spanclass="n">ConfigurationError</span><spanclass="p">(</span><spanclass="s1">'You must specify "config" or "config_file" or "db_url"'</span><spanclass="p">)</span>
0 commit comments