From 874556e374b29bbb461c47cf823099c8dcf94fba Mon Sep 17 00:00:00 2001 From: Braelyn Boynton Date: Thu, 2 Jan 2025 00:34:00 +0000 Subject: [PATCH 1/2] codecov and test fixes --- .github/workflows/codecov.yml | 43 +++++++++++++++++++++++++++++++++++ tests/test_agents_config.py | 8 +++---- tests/test_tasks_config.py | 12 +++++----- tox.ini | 26 ++++++++++++++------- 4 files changed, 71 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..459dae36 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,43 @@ +name: Codecov + +on: + push: + branches: + - main + paths: + - 'agentstack/**/*.py' + pull_request: + branches: + - main + paths: + - 'agentstack/**/*.py' + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox + + - name: Run tests with tox + run: tox + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: true diff --git a/tests/test_agents_config.py b/tests/test_agents_config.py index 5b110192..58811a95 100644 --- a/tests/test_agents_config.py +++ b/tests/test_agents_config.py @@ -22,10 +22,10 @@ def tearDown(self): def test_empty_file(self): config = AgentConfig("agent_name") assert config.name == "agent_name" - assert config.role is "" - assert config.goal is "" - assert config.backstory is "" - assert config.llm is "" + assert config.role == "" + assert config.goal == "" + assert config.backstory == "" + assert config.llm == "" def test_read_minimal_yaml(self): shutil.copy(BASE_PATH / "fixtures/agents_min.yaml", self.project_dir / AGENTS_FILENAME) diff --git a/tests/test_tasks_config.py b/tests/test_tasks_config.py index 498ea9c8..394b8ced 100644 --- a/tests/test_tasks_config.py +++ b/tests/test_tasks_config.py @@ -22,17 +22,17 @@ def tearDown(self): def test_empty_file(self): config = TaskConfig("task_name") assert config.name == "task_name" - assert config.description is "" - assert config.expected_output is "" - assert config.agent is "" + assert config.description == "" + assert config.expected_output == "" + assert config.agent == "" def test_read_minimal_yaml(self): shutil.copy(BASE_PATH / "fixtures/tasks_min.yaml", self.project_dir / TASKS_FILENAME) config = TaskConfig("task_name") assert config.name == "task_name" - assert config.description is "" - assert config.expected_output is "" - assert config.agent is "" + assert config.description == "" + assert config.expected_output == "" + assert config.agent == "" def test_read_maximal_yaml(self): shutil.copy(BASE_PATH / "fixtures/tasks_max.yaml", self.project_dir / TASKS_FILENAME) diff --git a/tox.ini b/tox.ini index 6c6a966b..bc051f83 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,3 @@ -# tox (https://tox.readthedocs.io/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - [tox] envlist = py310,py311,py312 @@ -10,10 +5,25 @@ envlist = py310,py311,py312 deps = pytest parameterized + coverage mypy: mypy commands = - pytest -v {posargs} - mypy: mypy agentops + coverage run --source=. --omit="**/tmp/**,./tmp/**/*" -m pytest -v {posargs} + coverage report -m + coverage xml + mypy: mypy agentstack setenv = AGENTSTACK_TELEMETRY_OPT_OUT = 1 - AGENTSTACK_UPDATE_DISABLE = 1 \ No newline at end of file + AGENTSTACK_UPDATE_DISABLE = 1 + +[coverage:run] +branch = True +source = . +omit = + **/tmp/** + ./tmp/**/* + +[coverage:report] +omit = + **/tmp/** + ./tmp/**/* From d4223910cf6782c33a7d2884ff78844862d5afe9 Mon Sep 17 00:00:00 2001 From: Braelyn Boynton Date: Thu, 2 Jan 2025 00:37:41 +0000 Subject: [PATCH 2/2] return comment --- tox.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tox.ini b/tox.ini index bc051f83..a29b10e8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,8 @@ +# tox (https://tox.readthedocs.io/) is a tool for running tests +# in multiple virtualenvs. This configuration file will run the +# test suite on all supported python versions. To use it, "pip install tox" +# and then run "tox" from this directory. + [tox] envlist = py310,py311,py312