<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <id>https://nuitka.net/</id>
  <title>Nuitka Blog - Posts tagged pytest</title>
  <updated>2026-05-14T19:04:10.587298+00:00</updated>
  <link href="https://nuitka.net/"/>
  <link href="https://nuitka.net/blog/tag/pytest/atom.xml" rel="self"/>
  <generator uri="https://ablog.readthedocs.io/" version="0.11.6">ABlog</generator>
  <entry>
    <id>https://nuitka.net/posts/tommy-gsoc-summary.html</id>
    <title>Intro</title>
    <updated>2019-08-23T07:00:00+02:00</updated>
    <author>
      <name>Taofeng(Tommy) Li</name>
    </author>
    <content type="html">&lt;section id="intro"&gt;

&lt;p&gt;As Google Summer of Code (GSoC) is coming to an end, I am writing this
blog post as a final summary describing all the work I have done as well
as my experiences in this program.&lt;/p&gt;
&lt;/section&gt;
&lt;section id="summary-of-my-work"&gt;
&lt;h1&gt;Summary of My Work&lt;/h1&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/314"&gt;#314 run_all.py new special-comment mechanism &amp;amp; Urllib3Using.py&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Before GSoC started, I looked around for whatever work I could
help with.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In this pull request, I added a &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;checkRequirements&lt;/span&gt;&lt;/code&gt; function for
the Nuitka standalone test suite.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This function checks for special-comments at the top of standalone
tests in the format of &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;#&lt;/span&gt; &lt;span class="pre"&gt;nuitka-skip-unless-expression:&lt;/span&gt;
&lt;span class="pre"&gt;expression&lt;/span&gt; &lt;span class="pre"&gt;to&lt;/span&gt; &lt;span class="pre"&gt;be&lt;/span&gt; &lt;span class="pre"&gt;evaluated&lt;/span&gt;&lt;/code&gt; OR &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;#&lt;/span&gt; &lt;span class="pre"&gt;nuitka-skip-unless-imports:&lt;/span&gt;
&lt;span class="pre"&gt;module1,module2,...&lt;/span&gt;&lt;/code&gt; and will decide whether to skip a test
depending on if its specified requirements are met.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In addition, standalone test &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;Urllib3Using.py&lt;/span&gt;&lt;/code&gt; was created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This pull request was soon merged and allowed me the lucky
opportunity of GSoC 2019 with Nuitka :)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/339"&gt;#339 Standalone tests for botocore &amp;amp; boto3 + fix to Urllib3Using.py&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This PR was also created before the start of GSoC.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Standalone test &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;Boto3Using.py&lt;/span&gt;&lt;/code&gt; was created using &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;moto&lt;/span&gt;&lt;/code&gt; to
mock AWS calls which did not turn out well.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Changed &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;Urllib3Using.py&lt;/span&gt;&lt;/code&gt; with the addition of python version
checks as a fix to &lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/issues/373"&gt;Issue #373&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://nuitka.net/posts/urllib3-wheel-with-nuitka.html"&gt;Urllib3 Wheel with Nuitka Pytest Results&lt;/a&gt; and
&lt;a class="reference external" href="https://nuitka.net/posts/dateutil-wheel-with-nuitka.html"&gt;Python-Dateutil Wheel with Nuitka Pytest Results&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;At the start of GSoC, I performed manual pytest comparison for
PyPI packages &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;urllib3&lt;/span&gt;&lt;/code&gt; and &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;dateutil&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The findings of my testing were documented in these postings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Manual testing compares the pytest results of an installed nuitka
wheel built using &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;python&lt;/span&gt; &lt;span class="pre"&gt;setup.py&lt;/span&gt; &lt;span class="pre"&gt;bdist_nuitka&lt;/span&gt;&lt;/code&gt; to the regular
pytest results of each package.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing is done to ensure that nuitka is building the wheel
correctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the pytests pass/fail in the same way, that means Nuitka built
the wheel properly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Else if the tests differ, then something is wrong.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Virtualenv is used to create a clean environment with no outside
pollution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Over the course of performing manual testing, I became familiar
with the use of &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;virtualenv&lt;/span&gt;&lt;/code&gt;, &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;wheel&lt;/span&gt;&lt;/code&gt;, and &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;pytest&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A bug was found with the package &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;urllib3&lt;/span&gt;&lt;/code&gt; bdist and I created
&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/issues/413"&gt;Issue #413&lt;/a&gt; to
document the bug.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/440"&gt;#440 Automating PyPI Wheel Pytest&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After familiarizing myself with how &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;virtualenv&lt;/span&gt;&lt;/code&gt;, &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;wheel&lt;/span&gt;&lt;/code&gt;, and
&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;pytest&lt;/span&gt;&lt;/code&gt; work, I started to work on a script which would
automate the pytest comparison for top PyPI packages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The script first uses &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;git&lt;/span&gt;&lt;/code&gt; to update each package if it is
already existing in the local cache, else it will &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;git&lt;/span&gt; &lt;span class="pre"&gt;clone&lt;/span&gt;&lt;/code&gt;
that package into the local cache.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The script then uses calls to &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;os.system&lt;/span&gt;&lt;/code&gt; to automate the
creation of a &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;virtualenv&lt;/span&gt;&lt;/code&gt; which is then used to install
&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;pytest&lt;/span&gt;&lt;/code&gt; and &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;pip&lt;/span&gt; &lt;span class="pre"&gt;install&lt;/span&gt;&lt;/code&gt; the package’s requirements (if any)
for running pytest.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The script then handles each package depending on different needs
before building a regular wheel with &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;python&lt;/span&gt; &lt;span class="pre"&gt;setup.py&lt;/span&gt;
&lt;span class="pre"&gt;bdist_wheel&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This wheel is then installed into the &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;virtualenv&lt;/span&gt;&lt;/code&gt;, after which
&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;subprocess.Popen&lt;/span&gt;&lt;/code&gt; is used to run and capture the output of
&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;python&lt;/span&gt; &lt;span class="pre"&gt;-m&lt;/span&gt; &lt;span class="pre"&gt;pytest&lt;/span&gt; &lt;span class="pre"&gt;--disable-warnings&lt;/span&gt;&lt;/code&gt; into a string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The script then resets the package to its original state and
builds a nuitka-compiled wheel using &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;python&lt;/span&gt; &lt;span class="pre"&gt;setup.py&lt;/span&gt;
&lt;span class="pre"&gt;bdist_nuitka&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This compiled wheel is then installed into the &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;virtualenv&lt;/span&gt;&lt;/code&gt;,
after which &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;subprocess.Popen&lt;/span&gt;&lt;/code&gt; is used to run and capture the
output of &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;python&lt;/span&gt; &lt;span class="pre"&gt;-m&lt;/span&gt; &lt;span class="pre"&gt;pytest&lt;/span&gt; &lt;span class="pre"&gt;--disable-warnings&lt;/span&gt;&lt;/code&gt; into another
string.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The two strings containing pytest outputs are then compared to
find differences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If no differences are found, this means &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;bdist_nuitka&lt;/span&gt;&lt;/code&gt; worked
properly. Else Nuitka compilation did something wrong.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The above process is repeated for each suitable PyPI package from
the PyPI top 50. (Some packages are left out if they do not
contain a test suite or if they do not need to be tested)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;At the end, a colored summary is given for all the packages
tested.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This automation script is meant to be run regularly to inform
developers of Nuitka regressions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/issues/477"&gt;Issue #477 Unable to compile modules listed under
unworthy_namespaces&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Raised due to package &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;pycparser&lt;/span&gt;&lt;/code&gt; failing in the automated test
suite.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This issue will be addressed in the future.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/issues/479"&gt;Issue #479 bdist_nuitka fails for packages containing py_modules
only&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;While I worked on &lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/440"&gt;#440&lt;/a&gt;, I found a bug with
&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;bdist_nuitka&lt;/span&gt;&lt;/code&gt; failing on PyPI packages containing py_modules
only.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This bug occurs due to Nuitka making the assumption that a main
package always exists for all packages. However, some packages
contain only a main module and not a main package.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Applies to PyPI packages &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;decorator&lt;/span&gt;&lt;/code&gt;, &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;ipaddress&lt;/span&gt;&lt;/code&gt;, and
&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;pyparsing&lt;/span&gt;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/483"&gt;#483 Add support for py_modules_only compilation&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This pull request changes &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;bdist_nuitka.py&lt;/span&gt;&lt;/code&gt; and various other
files to fix &lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/issues/479"&gt;Issue #479&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Checks are added for the &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;bdist_nuitka&lt;/span&gt;&lt;/code&gt; command to see if a main
package exists. If there is not a main package, it will set its
compile target to the main module instead.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This also addressed the case of a package with both a main package
and a main module, in which case both are included inside the
resulting wheel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In addition, &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;distutils&lt;/span&gt;&lt;/code&gt; examples &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;py_modules_only&lt;/span&gt;&lt;/code&gt; and
&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;package_and_module&lt;/span&gt;&lt;/code&gt; were created and added for future testing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;During this PR, I found an import bug in Nuitka and hotfixed it
with &lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/487"&gt;#487 Fixup_import_module&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/484"&gt;#484 PyPI Standalone Tests&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;This pull request adds more standalone tests for each top PyPI
package.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/495"&gt;#495 Improve pypi automation&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Improves the PyPI test suite created in &lt;a class="reference external" href="https://github.com/Nuitka/Nuitka/pull/440"&gt;#440&lt;/a&gt; with functional
improvements, readability improvements, and added documentation.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id="things-i-learned"&gt;
&lt;h1&gt;Things I Learned&lt;/h1&gt;
&lt;p&gt;Before GSoC, I was very uncomfortable with working inside a terminal. I
was unfamiliar with many basic bash commands because I simply did not
have any prior professional industrial experiences. I was also very
unfamiliar with the Git flow, which is evident in the messy commit
histories of my earliest pull requests.&lt;/p&gt;
&lt;p&gt;As I continued throughout my GSoC journey, however, I became much more
comfortable with working inside the terminal as well as using &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;git&lt;/span&gt;&lt;/code&gt; as
a version-control system (shoutout to my mentor Kay Hayen for helping me
through all the annoying conflicts).&lt;/p&gt;
&lt;p&gt;Although I am still no expert, I can confidently say that I am now far
more proficient working with &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;git&lt;/span&gt;&lt;/code&gt; and inside the terminal.&lt;/p&gt;
&lt;p&gt;In addition, I became much more familiar with many of the most popular
PyPI packages as well as the inner workings of &lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;python&lt;/span&gt;&lt;/code&gt;, which I
believe will help me go very far in my career as a software developer.&lt;/p&gt;
&lt;p&gt;Overall, the GSoC experience was truly astounding and I am more than
thankful to my mentor Kay Hayen as well as Google for making this
amazing program possible.&lt;/p&gt;
&lt;p&gt;Yours, &lt;a class="reference external" href="https://github.com/tommyli3318"&gt;Tommy&lt;/a&gt;&lt;/p&gt;
&lt;/section&gt;
</content>
    <link href="https://nuitka.net/posts/tommy-gsoc-summary.html"/>
    <summary>As Google Summer of Code (GSoC) is coming to an end, I am writing this
blog post as a final summary describing all the work I have done as well
as my experiences in this program.</summary>
    <category term="Nuitka" label="Nuitka"/>
    <category term="automation" label="automation"/>
    <category term="gsoc2019" label="gsoc2019"/>
    <category term="pypi" label="pypi"/>
    <category term="pytest" label="pytest"/>
    <category term="standalone" label="standalone"/>
    <category term="tests" label="tests"/>
    <published>2019-08-23T07:00:00+02:00</published>
  </entry>
</feed>
