Codium-ai / cover-agent

CodiumAI Cover-Agent: An AI-Powered Tool for Automated Test Generation and Code Coverage Enhancement! 💻🤖🧪🐞
https://www.codium.ai/
GNU Affero General Public License v3.0
4.07k stars 279 forks source link

Log Duplication #53

Closed iejzh closed 2 weeks ago

iejzh commented 2 months ago

The UnitTestGenerator logs twice, a detailed log with timestamps and an abbreviated log without timestamps.

截屏2024-05-27 10 57 56
EmbeddedDevops1 commented 1 month ago

@iejzh I'm not seeing this issue on main anymore. Are you still seeing this?

iejzh commented 1 month ago

@EmbeddedDevops1 Yes, I can still see this issue.

EmbeddedDevops1 commented 1 month ago

How can I replicate it? Can you share the full command that you ran?

iejzh commented 1 month ago

The commands are as follows:

cover-agent \
  --source-file-path "templated_tests/python_fastapi/app.py" \
  --test-file-path "templated_tests/python_fastapi/test_app.py" \
  --code-coverage-report-path "templated_tests/python_fastapi/coverage.xml" \
  --test-command "pytest --cov=. --cov-report=xml --cov-report=term" \
  --test-command-dir "templated_tests/python_fastapi" \
  --coverage-type "cobertura" \
  --desired-coverage 70 \
  --max-iterations 10

The days of cover_agent.UnitTestGenerator are printed twice in the console output: 2024-06-03 14:24:28,452 - cover_agent.UnitTestGenerator - INFO - Running build/test command to generate coverage report: "pytest --cov=. --cov-report=xml --cov-report=term" INFO:cover_agent.UnitTestGenerator:Running build/test command to generate coverage report: "pytest --cov=. --cov-report=xml --cov-report=term"

EmbeddedDevops1 commented 2 weeks ago

@iejzh I was able to reproduce this but only by importing Cover agent from an installed pip package and running it against a completely different repo in debug mode using VSCode (that also has a custom logger class). Otherwise, I can't see the log duplication.

What's your environment set up? You ran this command straight after installing the pip package?

cover-agent \
  --source-file-path "templated_tests/python_fastapi/app.py" \
  --test-file-path "templated_tests/python_fastapi/test_app.py" \
  --code-coverage-report-path "templated_tests/python_fastapi/coverage.xml" \
  --test-command "pytest --cov=. --cov-report=xml --cov-report=term" \
  --test-command-dir "templated_tests/python_fastapi" \
  --coverage-type "cobertura" \
  --desired-coverage 70 \
  --max-iterations 10