autogenhub / autogen

A programming framework for agentic AI. Discord: https://discord.gg/pAbnFJrkgZ
https://autogenhub.github.io/autogen/
Apache License 2.0
119 stars 23 forks source link

[Bug]: Unable to run tests in devcontainer or local #55

Closed r4881t closed 1 month ago

r4881t commented 1 month ago

Describe the bug

Hi, I tried to run tests in devcontainer, but failed for all the 3 types of devcontainers

I tried following:

  1. Opening the devcontainer "main" and running pytest -n auto and I get error as follows
vscode ➜ /workspaces/autogen (a49) $ pytest
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov=. --cov-append --cov-branch --cov-report=xml
  inifile: /workspaces/autogen/pyproject.toml
  rootdir: /workspaces/autogen
  1. Opening the devcontainer "dev" and running pytest -n auto and I get error as follows
autogen@44e8c3343779:/workspaces/autogen$ pytest -n auto
/usr/local/lib/python3.11/site-packages/_pytest/config/__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
UsageError: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n
  inifile: /workspaces/autogen/pyproject.toml
  rootdir: /workspaces/autogen
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n
  inifile: /workspaces/autogen/pyproject.toml
  rootdir: /workspaces/autogen
  1. Opening in devcontainer "full" and running the pytest -n auto and I notice that for some reason it is unable to build devcontainer. It fails in the line RUN pip install autogen[teachable,lmm,retrievechat,mathchat,blendsearch] autogenra even after multiple attemptes. below is the complete logs attached.

remoteContainers-2024-10-05T06-25-12.620Z.log

  1. When I do this locally, by pytest -n auto, I get the following error
$ pytest test/coding/test_kubernetes_command_executor.py 
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --cov=. --cov-append --cov-branch --cov-report=xml
  inifile: /home/pranav/workspace/fere-ai/autogen/pyproject.toml
  rootdir: /home/pranav/workspace/fere-ai/autogen

Steps to reproduce

Open the autogen repo in Visual Studio Code and then open it in devcontainers. It will show you three options and pick any of the options and you will notice the issue.

Model Used

No response

Expected Behavior

For 1 & 2, It should run the pytest without any errors. For 3 It should build the container and then run the pytest

Screenshots and logs

No response

Additional Information

No response

r4881t commented 1 month ago

So it seems like I needed to do pip install pytest-cov pytest-xdist, after which the errors were gone and I was able to run the tests.

So, my expectation is that this additional dependency should be auto installed when using devcontainers.

Hk669 commented 1 month ago

So it seems like I needed to do pip install pytest-cov pytest-xdist, after which the errors were gone and I was able to run the tests.

So, my expectation is that this additional dependency should be auto installed when using devcontainers.

I was looking at the same fix. let me add the packages.

Hk669 commented 1 month ago

@r4881t can you help us review the PR #56