title: Handling exception in pytest fixture and pytest.fail vs assert in general
body: <p>Consider you have something like the following:</p>
  <pre><code>import pytest
  
  @pytest.fixture
  def foo_fixture():
      assert x == 1, &quot;X is not 1&quot;
      if x != 1:
          pytest.fail(&quot;X is not 1&quot;)
  
  
  def test_foo():
      assert x == 1, &quot;X is not 1&quot;
      if x != 1:
          pytest.fail(&quot;X is not 1&quot;)
  </code></pre>
  <p>Can someone please shed light on differences between raising errors via <code>pytest.fail</code> vs <code>assert</code>,<br />
  in both contexts - inside <code>pytest.fixture</code> or inside regular test function.</p>
  <p>What is the difference, what is more right\common to do in each case?</p>
  <p>Thank in advance</p>