title: Running a pytest test from a python file and NOT from a command line
body: <p>I have three python files in one directory (c:\Tests), I am trying to run the test using pytest from the file TestCases1.py but I have not succeed. I am new to python and I do not know if I am asking the right question. I have seen several examples but almost all use the command line to run the test and I want to run them from a python file. Since I am newbie to testing, I would appreciate a very simple answer (I have seen some similar questions but I did not get the answers). I am using Python 36-32 and Eclipse Oxygen 3a.</p>
  <p><strong>min_max.py</strong> =&gt; Some basic functions to be tested</p>
  <pre><code>def min(values):
      _min = values[0]
      for val in values:
          if val &lt; _min:
              _min = val
      return _min
  
      
  
  def max(values):
      _max = values[0]
      for val in values:
          if val &gt; _max:
              _max = valal
      return _max
  </code></pre>
  <p><strong>min_max_test.py</strong>  =&gt; Some tests for the functions</p>
  <pre><code>import min_max
  
  def test_min():
      print(&quot;starting&quot;)
      values = (2, 3, 1, 4, 6)
      val = min(values)
      assert val == 1
      print(&quot;done test_min&quot;)
  
  
  def test_max():
      print(&quot;starting&quot;)
      values = (2, 3, 1, 4, 6)
      val = max(values)
      assert val == 6
      print(&quot;done test_max&quot;) 
  </code></pre>
  <p><strong>TestCases1.py</strong> =&gt; File from where I want to run the test</p>
  <pre><code>import pytest
  pytest_args = [
      'c:\Tests\min_max_test.py'
  ]
  
  pytest.main(pytest_args)
  </code></pre>