Failing unit test
The test_check_modules test fails with the following stacktrace:
FAILED [100%]error reading C:\dev\imod-python\imod\tests/..\mf6\npf.py, with error: 'charmap' codec can't decode byte 0x9d in position 11658: character maps to <undefined>
test_code_checks.py:27 (test_check_modules)
def test_check_modules():
test_directory = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
paths = glob(test_directory + "/../**/*.py")
ok = True
for path in paths:
if test_directory in os.path.realpath(
path
): # if it's a test we don't care. this very file contains print statements itself.
continue
try:
with open(path) as f:
content = f.read()
try:
tree = ast.parse(content)
module_ok = check_ast(tree, path)
ok = ok and module_ok
except Exception as e:
print(f"parsing error in {path}, with error: {e}.")
ok = False
except Exception as e:
print(f"error reading {path}, with error: {e}")
ok = False
> assert ok
E assert False
test_code_checks.py:50: AssertionError
Edited by Sunny Titus