diff --git a/news/2 Fixes/17363.md b/news/2 Fixes/17363.md new file mode 100644 index 000000000000..9392ef1387b4 --- /dev/null +++ b/news/2 Fixes/17363.md @@ -0,0 +1 @@ +Fix for `unittest` ModuleNotFoundError when discovering tests. diff --git a/pythonFiles/testing_tools/unittest_discovery.py b/pythonFiles/testing_tools/unittest_discovery.py index 6e02f53d240a..d13ea1c10dd9 100644 --- a/pythonFiles/testing_tools/unittest_discovery.py +++ b/pythonFiles/testing_tools/unittest_discovery.py @@ -1,10 +1,12 @@ import unittest import inspect +import os import sys import traceback start_dir = sys.argv[1] pattern = sys.argv[2] +sys.path.insert(0, os.getcwd()) def get_sourceline(obj):