Skip to content

Commit 7c51c8c

Browse files
committed
Fix for unittest ModuleNotFoundError when discovering tests (#17369)
* Fix for ModuleNotFoundError * Add news * Ensure we use cwd * linting
1 parent e16cb1e commit 7c51c8c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

news/2 Fixes/17363.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix for `unittest` ModuleNotFoundError when discovering tests.

pythonFiles/testing_tools/unittest_discovery.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import unittest
22
import inspect
3+
import os
34
import sys
45
import traceback
56

67
start_dir = sys.argv[1]
78
pattern = sys.argv[2]
9+
sys.path.insert(0, os.getcwd())
810

911

1012
def get_sourceline(obj):

0 commit comments

Comments
 (0)