title: Python - Using pytest to skip test unless specified
body: <h1>Background</h1>
  
  <p>I have am using pytest to test a web scraper that pushes the data to a database. The class only pulls the html and pushes the html to a database to be parsed later.  Most of my tests use dummy data to represent the html.   </p>
  
  <h1>Question</h1>
  
  <p>I want to do a test where a webpage from the website is scraped but I want the test to be automatically turned off unless specified. A similar scenario could be if you have an expensive or time consuming test that you do not want to always run. </p>
  
  <h1>Expected Solution</h1>
  
  <p>I am expecting some kind of marker that suppresses a test unless I give pytest to run all suppressed tests, but I do not see that in the documentation.</p>
  
  <h1>What I have done</h1>
  
  <ul>
  <li>I am currently using the skip marker and comment it out.     </li>
  <li><p>Tried to use the <a href="https://docs.pytest.org/en/latest/reference.html#pytest-mark-skipif-ref" rel="noreferrer">skipif</a> marker and and give arguments to python script using this command from command prompt <code>pytest test_file.py 1</code> and the following code below in the test file.  The problem is that when I try to provide an argument to my test_file, pytest is expecting that to be another file name so I get an error "no tests run in 0.00 seconds, ERROR: file not found: 1"</p>
  
  <pre><code>if len(sys.argv) == 1:
    RUN_ALL_TESTS = False
  else:
    RUN_ALL_TESTS = True
  ...
  # other tests
  ...
  
  @pytest.mark.skipif(RUN_ALL_TESTS)
  def test_scrape_website():
    ...
  </code></pre></li>
  <li><p>I might be able to treat the test as a fixture and use <code>@pytest.fixture(autouse=False)</code>, not sure how to override the autouse variable though</p></li>
  <li><p>A similar solution was stated in <a href="https://stackoverflow.com/questions/28179026/how-to-skip-a-pytest-using-an-external-fixture">How to skip a pytest using an external fixture?</a> but this solutions seems more complicated than what I need. </p></li>
  </ul>