3

I have defined a function in __init__.py. While running pylint on __init__.py, it gives a warning about unused_variable on the function_name.

I don't want to disable this warning in general (for actual unused variables, etc.) but obviously I don't want a warning for the function definition. Sample __init__.py:

import os

test_enabled = True
run_all_tests = False     ## Raises 'unused_variable' warning, expected and want to keep such warnings

def is_test_enabled():    ## Raises 'unused_variable' warning, unexpected and want to disable
    return <test_object> if test_enabled else None
Daniel Walker
  • 6,380
  • 5
  • 22
  • 45
  • i think the warning is because you are not using the run_all_tests variable anywhere in the code you have given – Prathamesh Jun 12 '20 at 14:47
  • Hey @PrathameshJadhav. I am getting 2 warnings. One for run_all_tests, another for is_test_enabled. I have mentioned both (with comments) to highlight my issue. – Kanishk Varshney Jun 12 '20 at 15:22

0 Answers0