kmmbvnr / django-jenkins

Plug and play continuous integration with django and jenkins
GNU Lesser General Public License v3.0
945 stars 279 forks source link

COVERAGE_EXCLUDES_FOLDERS does not exclude tests from coverage.xml output #364

Closed peteyb closed 6 years ago

peteyb commented 6 years ago

When running the django-jenkins command with COVERAGE_EXCLUDES_FOLDERS set the coverage.xml report still contains files within the excluded directory.

Running Python 3.6 and Django 2.0

python manage.py jenkins --enable-coverage --settings=myapp.settings_tests --coverage-exclude=COVERAGE_EXCLUDES_FOLDERS

INSTALLED_APPS += ('django_jenkins',)
JENKINS_TASKS = (
    'django_jenkins.tasks.run_pylint',
)
PROJECT_APPS = ('main', 'api')
COVERAGE_EXCLUDES_FOLDERS = (
    'main/migrations/*',
    'main/tests/*',
    'api/migrations/*',
    'api/tests/*',
)

Snippet from coverage.xml

<package branch-rate="1" complexity="0" line-rate="1" name="api.tests">
            <classes>
                <class branch-rate="1" complexity="0" filename="api/tests/__init__.py" line-rate="1" name="__init__.py">
                    <methods/>
                    <lines/>
                </class>
                <class branch-rate="1" complexity="0" filename="api/tests/tests_views.py" line-rate="1" name="tests_views.py">
bmjr commented 6 years ago

I've got the exact same issue, BUMP!

peteyb commented 6 years ago

I have just this week worked around this issue by changing my settings file to this:

COVERAGE_EXCLUDES = (
    'main.migrations',
    'main.tests',
    'api.migrations',
    'api.tests'
)

and to remove the --coverage-exclude from the command as the above is now in place