<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unit test with Nutter in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/unit-test-with-nutter/m-p/10540#M5706</link>
    <description>&lt;P&gt;When I run the simple test in a notebook, it works fine, but when I run it from the Azure ADO pipeline, it fails with the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code;&lt;/P&gt;&lt;P&gt;def __init__(self):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;NutterFixture.__init__(self)&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from runtime.nutterfixture import NutterFixture, tag&lt;/P&gt;&lt;P&gt;class uTestsDataBricks(NutterFixture):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;def assertion_test_SampleB(self):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;assert (1 == 1)&lt;/P&gt;&lt;P&gt;result = uTestsDataBricks().execute_tests()&lt;/P&gt;&lt;P&gt;result = uTestsDataBricks().execute_tests()&lt;/P&gt;&lt;P&gt;print(result.to_string())&lt;/P&gt;&lt;P&gt;is_job = dbutils.notebook.entry_point.getDbutils().notebook().getContext().currentRunId().isDefined()&lt;/P&gt;&lt;P&gt;if is_job:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;result.exit(dbutils)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Error message:&lt;/B&gt;&lt;/P&gt;&lt;P&gt;In a notebook, it works fine, but when I run it from the Azure ADO pipeline, it shows that test executed but I don't get result That it PASSED or FAILED . I get an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nutter Version 0.1.35&amp;nbsp;&lt;/P&gt;&lt;P&gt;++++++++++++++++++++++++++++++++++++++++++++++++++&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;gt; 1 of 1 tests scheduled for execution&lt;/P&gt;&lt;P&gt;CRITICAL:NutterCLI:'&amp;lt;' not supported between instances of 'str' and 'int'&lt;/P&gt;&lt;P&gt;--&amp;gt; 1 of 1 tests executed&lt;/P&gt;&lt;P&gt;Fatal Python error: _enter_buffered_busy: could not acquire lock for &amp;lt;_io.BufferedWriter name='&amp;lt;stdout&amp;gt;'&amp;gt; at interpreter shutdown, possibly due to daemon threads&lt;/P&gt;&lt;P&gt;Python runtime state: finalizing (tstate=00000174CFECF6D0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current thread 0x00000414 (most recent call first):&lt;/P&gt;&lt;P&gt;&amp;lt;no Python frame&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 28 Jan 2023 06:06:06 GMT</pubDate>
    <dc:creator>Chris_Konsur</dc:creator>
    <dc:date>2023-01-28T06:06:06Z</dc:date>
    <item>
      <title>Unit test with Nutter</title>
      <link>https://community.databricks.com/t5/data-engineering/unit-test-with-nutter/m-p/10540#M5706</link>
      <description>&lt;P&gt;When I run the simple test in a notebook, it works fine, but when I run it from the Azure ADO pipeline, it fails with the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code;&lt;/P&gt;&lt;P&gt;def __init__(self):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;NutterFixture.__init__(self)&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from runtime.nutterfixture import NutterFixture, tag&lt;/P&gt;&lt;P&gt;class uTestsDataBricks(NutterFixture):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;def assertion_test_SampleB(self):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;assert (1 == 1)&lt;/P&gt;&lt;P&gt;result = uTestsDataBricks().execute_tests()&lt;/P&gt;&lt;P&gt;result = uTestsDataBricks().execute_tests()&lt;/P&gt;&lt;P&gt;print(result.to_string())&lt;/P&gt;&lt;P&gt;is_job = dbutils.notebook.entry_point.getDbutils().notebook().getContext().currentRunId().isDefined()&lt;/P&gt;&lt;P&gt;if is_job:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;result.exit(dbutils)&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Error message:&lt;/B&gt;&lt;/P&gt;&lt;P&gt;In a notebook, it works fine, but when I run it from the Azure ADO pipeline, it shows that test executed but I don't get result That it PASSED or FAILED . I get an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nutter Version 0.1.35&amp;nbsp;&lt;/P&gt;&lt;P&gt;++++++++++++++++++++++++++++++++++++++++++++++++++&amp;nbsp;&lt;/P&gt;&lt;P&gt;-&amp;gt; 1 of 1 tests scheduled for execution&lt;/P&gt;&lt;P&gt;CRITICAL:NutterCLI:'&amp;lt;' not supported between instances of 'str' and 'int'&lt;/P&gt;&lt;P&gt;--&amp;gt; 1 of 1 tests executed&lt;/P&gt;&lt;P&gt;Fatal Python error: _enter_buffered_busy: could not acquire lock for &amp;lt;_io.BufferedWriter name='&amp;lt;stdout&amp;gt;'&amp;gt; at interpreter shutdown, possibly due to daemon threads&lt;/P&gt;&lt;P&gt;Python runtime state: finalizing (tstate=00000174CFECF6D0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Current thread 0x00000414 (most recent call first):&lt;/P&gt;&lt;P&gt;&amp;lt;no Python frame&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2023 06:06:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unit-test-with-nutter/m-p/10540#M5706</guid>
      <dc:creator>Chris_Konsur</dc:creator>
      <dc:date>2023-01-28T06:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Unit test with Nutter</title>
      <link>https://community.databricks.com/t5/data-engineering/unit-test-with-nutter/m-p/10541#M5707</link>
      <description>&lt;P&gt;@Chris Konsur​&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error message suggests that there is an issue with the standard output buffer when the Python interpreter is shutting down, which could be related to daemon threads. This error is not specific to Databricks or Azure ADO pipeline, and it may be caused by some code running in your notebook or test environment.&lt;/P&gt;&lt;P&gt;One possible solution is to use a different approach for capturing and reporting the test results. Instead of relying on the standard output, you can use a test runner framework such as pytest or unittest to run the tests and generate a report that can be easily consumed by the pipeline. These frameworks also provide additional features such as test discovery, test fixtures, and test parameterization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if this helps you, else we can think of more options.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 14:14:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/unit-test-with-nutter/m-p/10541#M5707</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-10T14:14:45Z</dc:date>
    </item>
  </channel>
</rss>

