Python import command is raised "Not covered by tests"

Many python files in my project are raised “not covered by tests” at import commands. For example:

import logging.config
import os
import json

How can I exclude this part?

Hello @ducminhgd,

Please note that SonarQube doesn’t actually compute your coverage report. As you can see in the documentation, what is does is importing an existing coverage report.

It seems to me that the problem you’re encountering is more related to how you produce the report than how SonarQube consumes it. It is possible to exclude certain files from coverage calculation, as described here, but I don’t think that would solve the root cause of your problem.

Hope that helps,