-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Describe the bug
A change made by #1097 interferes with manual testing (not using pytest) of many scripts under the test dir because they now contain the following import:
from conftest import skip_openai
#1097 added test/conftest.py, but the test dir is not normally in sys.path, so manually running a script fails with this error:
ModuleNotFoundError: No module named 'conftest'
Maybe pytest avoids this error by appending the test dir to sys.path.
One solution is to add a line like the following right before the import of skip_openai:
sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
Similarly, 7 of our test scripts (like test_gpt_assistant.py) already append to sys.path in order to import from test_assistant_agent:
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402
I can make a PR modifying sys.path so that scripts under test can find conftest when run manually. Or is there a simpler solution?
Steps to reproduce
python test/agentchat/contrib/test_teachable_agent.py
Expected Behavior
The test should run to completion.
Screenshots and logs
No response
Additional Information
No response