Tests folder specification not working

Hi, we started using SonarCloud for our project written in Python.

The folder structure is:

project/
|
|--code/
|--static/
|--templates/
|--tests/
|--sonar-project.properties
...

We set the config as:

sonar.sources=.
sonar.exclusions=tests/

sonar.tests=.
sonar.test.inclusions=tests/

to classify the tests folder, as we read it’s a good practice and it should lower the lines of code billed.

However, how can we check that the tests folder is indeed correctly classified? When we go to the dashboard of the project → tab “Code” it seems as if the tests folder is still counted as a normal source folder:

Hi,

Welcome to the community!

sonar.sources and sonar.tests both accept comma-delimited lists of directories. There’s no need to do what you’ve done with inclusions & exclusions. Instead:

sonar.sources=code, static, templates
sonar.tests=tests

There used to be a difference in the icons for test and source files, but it seems that got “improved” away. :frowning:

Instead, you’ll need to look at what metrics are calculated for the files. Since Lines of Code are calculated for this directory, at least some of its files are counted as code.

 
HTH,
Ann