MetaGPT icon indicating copy to clipboard operation
MetaGPT copied to clipboard

单元测试报文件被占用错误

Open zkewind opened this issue 1 year ago • 1 comments

Bug description

执行单元测试,报文件被占用错误。

Bug solved method 未解决

Environment information 环境:win10 idea python 10

  • LLM type and model name:
  • System version:win10
  • Python version:3.9.18
  • packages version:
  • installation method:

Screenshots or logs tests\metagpt\test_document.py:29 (test_repo_set_load) def fin():

  CONFIG.git_repo.delete_repository()

conftest.py:162:


..\metagpt\utils\git_repository.py:110: in delete_repository shutil.rmtree(self._repository.working_dir) C:\ProgramData\anaconda3\envs\MetaGPT2\lib\shutil.py:759: in rmtree return _rmtree_unsafe(path, onerror) C:\ProgramData\anaconda3\envs\MetaGPT2\lib\shutil.py:633: in _rmtree_unsafe onerror(os.rmdir, path, sys.exc_info())


path = 'C:\Users\zkewi\data\proj\chatgpt\MetaGPT-github2\workspace\unittest\5e2e39b133e448eeb37be68d6be6916a' try:

      os.rmdir(path)

E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\zkewi\data\proj\chatgpt\MetaGPT-github2\workspace\unittest\5e2e39b133e448eeb37be68d6be6916a'

zkewind avatar Jan 13 '24 08:01 zkewind

试试重启电脑,然后重新跑这个代码。

voidking avatar Jan 17 '24 11:01 voidking

This issue should have been fixed by @iorisa before. If you still have this problem, reopen this issue

geekan avatar Mar 21 '24 11:03 geekan

Bug description

执行单元测试,报文件被占用错误。

Bug solved method 未解决

Environment information 环境:win10 idea python 10

  • LLM type and model name:

  • System version:win10

  • Python version:3.9.18

  • packages version:

  • installation method:

Screenshots or logs tests\metagpt\test_document.py:29 (test_repo_set_load) def fin():

  CONFIG.git_repo.delete_repository()

conftest.py:162:

..\metagpt\utils\git_repository.py:110: in delete_repository shutil.rmtree(self._repository.working_dir) C:\ProgramData\anaconda3\envs\MetaGPT2\lib\shutil.py:759: in rmtree return _rmtree_unsafe(path, onerror) C:\ProgramData\anaconda3\envs\MetaGPT2\lib\shutil.py:633: in _rmtree_unsafe onerror(os.rmdir, path, sys.exc_info())

path = 'C:\Users\zkewi\data\proj\chatgpt\MetaGPT-github2\workspace\unittest\5e2e39b133e448eeb37be68d6be6916a' try:

      os.rmdir(path)

E PermissionError: [WinError 32] 另一个程序正在使用此文件,进程无法访问。: 'C:\Users\zkewi\data\proj\chatgpt\MetaGPT-github2\workspace\unittest\5e2e39b133e448eeb37be68d6be6916a'

你好,请问这个单元测试是怎么跑的,我直接pytest + 文件名报错,看起来是配置不对。 ` rsp_cache = {'\n\nExtract relevant information from every preceding sentence and use it to succinctly supplement or rewrite the fo...nship between sepal length and sepal width, color-coded by species.",\n "task_type": "eda"\n }\n]\n```', ...} mocker = <pytest_mock.plugin.MockerFixture object at 0x7fc8049b4410>, request = <SubRequest 'llm_mock' for <Function test_product_manager>>

@pytest.fixture(scope="function", autouse=True)
def llm_mock(rsp_cache, mocker, request):
  llm = MockLLM(allow_open_api_call=ALLOW_OPENAI_API_CALL)

tests/conftest.py:67:


tests/mock/mock_llm.py:20: in init super().init(original_llm_config) metagpt/provider/openai_api.py:60: in init self._init_client() metagpt/provider/azure_openai_api.py:24: in _init_client kwargs = self._make_client_kwargs()


self = <tests.mock.mock_llm.MockLLM object at 0x7fc8049b7990> def _make_client_kwargs(self) -> dict: kwargs = dict(

      api_key=self.config.api_key,
        api_version=self.config.api_version,
        azure_endpoint=self.config.base_url,
    )

E AttributeError: 'NoneType' object has no attribute 'api_key' metagpt/provider/azure_openai_api.py:32: AttributeError `

shroud777 avatar Jun 20 '24 12:06 shroud777