title: PyTest test-suite passing when asserts should fail when testing another thread's results in Python?
body: <p>I'm currently using pytest to test an existing (unittest test-suite <a href="https://docs.pytest.org/en/latest/existingtestsuite.html" rel="noreferrer">per the documentation</a>). I'm currently writing a thread that waits for an IP address to be assigned and then returns it to a callback function, and I'm writing unittests to accompany it.</p>
  
  <p>Here's the Test Case class I wrote.</p>
  
  <pre><code>class TestGetIpAddressOnNewThread(unittest.TestCase):
  
      def test_get_existing_ip(self):
          def func(ip):
              assert ip == "192.168.0.1" # Not the real IP
              # Even when I introduce an assert statement that should fail, test still passes
              assert ip == "shouldn't be the ip" 
  
          ip_check = GetInstanceIpThread(instance, func)
          ip_check.start()
          ip_check.join()
  
  if __name__ == '__main__':
      pytest.main()
  </code></pre>
  
  <p>And here's the <code>GetInstanceIpThread</code> pseudo-definition:</p>
  
  <pre><code>class GetInstanceIpThread(threading.Thread):
      def __init__(self, instance, callback):
          threading.Thread.__init__(self)
          self.event = threading.Event()
          self.instance = instance
          self.callback = callback
  
      def run(self):
          self.instance.wait_until_running()
  
          ip = self.instance.ip_address
          self.callback(ip)
  </code></pre>
  
  <p>When I run this test case using <code>pytest path_to_file.py::TestGetIpAddressOnNewThread</code>, it passes (yay!) but even when I introduce assert statements that should 100% fail (boo!). What's going wrong, how do I write tests that actually fail? </p>