title: Ignoring Test Files with Nose/unittest
body: <p>I have two test files. </p>
  
  <p>One is standard TestCases.  The other has selenium tests in it.  I have a docker-compose file setup to run the selenium tests with their associated services.</p>
  
  <p>The tests run in bitbucket-pipelines.  First it runs the test with the standard TestCases.  Then in the next step it uses docker-compose to run the tests that include selenium since it needs compose to set up the selenium services.</p>
  
  <p>The issue I'm having is it's trying to run the selenium tests during the first step when there isn't any selenium containers running.</p>
  
  <p>I entered this in my Django settings file used for the first testing part:</p>
  
  <pre><code>NOSE_ARGS = [
      '--exclude=(__init__.py)',
      '--exclude=(../tests/selenium_tests.py)',
      '--exclude=(selenium_tests.py)',
      '--with-coverage',
      '--cover-package=sasite',
      '--with-xunit',
      '--xunit-file=test-results/nose/noseresults.xml',
      '--verbosity=3',
      '--cover-xml',
      '--cover-xml-file=test-results/nose/noseresults.xml',
      '--id-file=test-results/nose/noseids'
  ]
  </code></pre>
  
  <p>and in my settings for the second:</p>
  
  <pre><code>NOSE_ARGS = [
      '--exclude=(__init__.py)',
      '--with-coverage',
      '--cover-package=sasite',
      '--with-xunit',
      '--xunit-file=test-results/nose/noseresults.xml',
      '--verbosity=3',
      '--cover-xml',
      '--cover-xml-file=test-results/nose/noseresults.xml',
      '--id-file=test-results/nose/noseids'
  ]
  </code></pre>
  
  <p>As you can see, I want to exclude the selenium tests for the first part, and use them for the second.  But even with my exclude in nose_args it still runs the selenium tests in the first part.</p>
  
  <p>Here is my bitbucket-pipelines.yml:</p>
  
  <pre><code>   prod-final:
        - step:
            name: Build image, run tests, and push to Docker Hub
            caches:
              - docker
            services:
              - docker
            script:
              # Set $DOCKER_HUB_USERNAME and $DOCKER_HUB_PASSWORD as environment variables in repository settings
              - export DOCKER_HUB_USERNAME=X
              - export DOCKER_HUB_PASSWORD=XXX
  
              # build the Docker image (this will use the Dockerfile in the root of the repo)
              - docker build -t meleiyu/sawebsite-redesign -f Dockerfile.imagetest .
              # run tests
              - docker run meleiyu/sawebsite-redesign
              # tag Docker image
              - docker tag meleiyu/sawebsite-redesign meleiyu/sawebsite-redesign:latest
              # authenticate with the Docker Hub registry
              - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
              # push the new Docker image to the Docker registry
              - docker push meleiyu/sawebsite-redesign:latest      
        - step:
            name: Run second level of testing with BrowserStack
            image: docker:stable
            trigger: manual          
            caches:
              - docker
            services:
              - docker
            script:
              # Test production setup with compose
              - apk add --no-cache py-pip bash
              - pip install --no-cache docker-compose
              - docker-compose -f docker-compose.test.yml up -d --build --exit-code-from app
        - step:
            # set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION as environment variables
            name: Deploy to AWS
            deployment: staging   # set to test, staging or production
            trigger: manual  # uncomment to have a manual step
            image: atlassian/pipelines-awscli
            script:
              - aws deploy push --application-name sawebsite-redesign --s3-location s3://&lt;S3 bucket&gt;/&lt;s3-key&gt; --ignore-hidden-files
              - aws deploy create-deployment --application-name sawebsite-redesign --s3-location bucket=&lt;s3-bucket&gt;,key=&lt;s3-key&gt;,bundleType=zip --deployment-group-name &lt;deployment-group&gt;
  
  definitions:
    services:
      docker:
        memory: 3072
  </code></pre>
  
  <p>Dockerfile.imagetest is for the first part, and has the settings to exclude selenium tests file.</p>
  
  <p>Dockerfile.test and docker-compose.test.yml are for the second part and don't exclude the selenium tests file.</p>
  
  <p>Does my config/setup make sense??  Am I excluding the files correctly in nose_args?  Because as I said it's running the selenium tests in part one when it shouldn't be doing so.</p>
  
  <p>Any input would be appreciated.</p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>My NOSE_ARGS now:</p>
  
  <p>To not ignore any tests:</p>
  
  <pre><code>NOSE_ARGS = [
      '--exclude=(__init__.py)',
      '--with-coverage',
      '--cover-package=sasite',
      '--with-xunit',
      '--xunit-file=test-results/nose/noseresults.xml',
      '--verbosity=3',
      '--cover-xml',
      '--cover-xml-file=test-results/nose/noseresults.xml',
      '--id-file=test-results/nose/noseids'
  ]
  </code></pre>
  
  <p>To exclude selenium tests:</p>
  
  <pre><code>NOSE_ARGS = [
      '--exclude=(__init__.py)',
      '--exclude=(../tests/selenium_tests.py)',
      '--exclude=(selenium_tests.py)',
      '--ignore=(selenium_tests.py)',
      '--ignore=(../tests/selenium_tests.py)',
      '--ignore-files=../tests/selenium_tests.py',    
      '--ignore-files=selenium_tests.py',    
      '--with-coverage',
      '--cover-package=sasite',
      '--with-xunit',
      '--xunit-file=test-results/nose/noseresults.xml',
      '--verbosity=3',
      '--cover-xml',
      '--cover-xml-file=test-results/nose/noseresults.xml',
      '--id-file=test-results/nose/noseids'
  ]
  </code></pre>