title: Gitlab-CI for Python project with SonarQube
body: <p>I want to set Gitlab-CI for my python project with SonarQube. I have one problem with that.
  I set SonarQube variables in settings gitlab-ci.</p>
  <p>This is my gitlab-ci.yml file:</p>
  <pre><code>variables:
  
      SONARQUBE_ARGUMENTS_NORMAL: -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD --stacktrace
      SONARQUBE_ARGUMENTS_PREVIEW: -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD --stacktrace -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$CI_PROJECT_PATH -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
      STAGE_ID: ${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${CI_JOB_NAME}_${CI_JOB_ID}
  
  image: &quot;python:3.7&quot;
  
  before_script:
    - python --version
    - python -c 'import struct;print( 8 * struct.calcsize(&quot;P&quot;))'
    - pip install --upgrade pip
    - pip install --upgrade setuptools
    - pip install pytest
    - pip install -r requirements.txt
  
  stages:
    - Static Analysis
    - Test
  
  mypy:
    stage: Static Analysis
    script:
    - python -m pip install mypy
    - pwd
    - ls -l
    - python -m mypy --ignore-missing-imports *.py
  
  flake8:
    stage: Static Analysis
    script:
    - python -m pip install flake8
    - flake8 --max-line-length=120 /*.py
  
  pylint:
    stage: Static Analysis
    script:
    - pip install pylint
    - pylint -d C0301,C0114 *.py
  
  test:
    stage: Test
    script:
    - pwd
    - ls -l
    - export PYTHONPATH=&quot;$PYTHONPATH:.&quot;
    - python -c &quot;import sys;print(sys.path)&quot;
    - pytest sonarqube $SONARQUBE_ARGUMENTS_NORMAL
  
  after_script:
    - echo &quot;End CI&quot;
  </code></pre>
  <p>Static analisys (flake8, mypy, pylint) works fine but I have problem with test stage where I use Pytest.
  In CI log I have that:</p>
  <pre><code> $ pytest sonarqube $SONARQUBE_ARGUMENTS_NORMAL
   ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
   pytest: error: unrecognized arguments: -Dsonar.host.url=http://127.0.0.0:8000 -Dsonar.login=my_login -Dsonar.password=my_password --stacktrace
  </code></pre>
  <p>Can you give me any idea, what I doing wrong?
  I doing that same in android project with gradle and that works fine.</p>
  <pre><code>./gradlew test sonarqube $SONARQUBE_ARGUMENTS_NORMAL
  </code></pre>