Skip to content

Commit a9a375d

Browse files
authored
Merge pull request #180 from AgentOps-AI/test-coverage
Code Coverage
2 parents 7296433 + d422391 commit a9a375d

File tree

4 files changed

+71
-13
lines changed

4 files changed

+71
-13
lines changed

.github/workflows/codecov.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Codecov
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'agentstack/**/*.py'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'agentstack/**/*.py'
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.11
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install tox
32+
33+
- name: Run tests with tox
34+
run: tox
35+
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v2
38+
with:
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
files: ./coverage.xml
41+
flags: unittests
42+
name: codecov-umbrella
43+
fail_ci_if_error: true

tests/test_agents_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def tearDown(self):
2222
def test_empty_file(self):
2323
config = AgentConfig("agent_name")
2424
assert config.name == "agent_name"
25-
assert config.role is ""
26-
assert config.goal is ""
27-
assert config.backstory is ""
28-
assert config.llm is ""
25+
assert config.role == ""
26+
assert config.goal == ""
27+
assert config.backstory == ""
28+
assert config.llm == ""
2929

3030
def test_read_minimal_yaml(self):
3131
shutil.copy(BASE_PATH / "fixtures/agents_min.yaml", self.project_dir / AGENTS_FILENAME)

tests/test_tasks_config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ def tearDown(self):
2222
def test_empty_file(self):
2323
config = TaskConfig("task_name")
2424
assert config.name == "task_name"
25-
assert config.description is ""
26-
assert config.expected_output is ""
27-
assert config.agent is ""
25+
assert config.description == ""
26+
assert config.expected_output == ""
27+
assert config.agent == ""
2828

2929
def test_read_minimal_yaml(self):
3030
shutil.copy(BASE_PATH / "fixtures/tasks_min.yaml", self.project_dir / TASKS_FILENAME)
3131
config = TaskConfig("task_name")
3232
assert config.name == "task_name"
33-
assert config.description is ""
34-
assert config.expected_output is ""
35-
assert config.agent is ""
33+
assert config.description == ""
34+
assert config.expected_output == ""
35+
assert config.agent == ""
3636

3737
def test_read_maximal_yaml(self):
3838
shutil.copy(BASE_PATH / "fixtures/tasks_max.yaml", self.project_dir / TASKS_FILENAME)

tox.ini

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,25 @@ envlist = py310,py311,py312
1010
deps =
1111
pytest
1212
parameterized
13+
coverage
1314
mypy: mypy
1415
commands =
15-
pytest -v {posargs}
16-
mypy: mypy agentops
16+
coverage run --source=. --omit="**/tmp/**,./tmp/**/*" -m pytest -v {posargs}
17+
coverage report -m
18+
coverage xml
19+
mypy: mypy agentstack
1720
setenv =
1821
AGENTSTACK_TELEMETRY_OPT_OUT = 1
19-
AGENTSTACK_UPDATE_DISABLE = 1
22+
AGENTSTACK_UPDATE_DISABLE = 1
23+
24+
[coverage:run]
25+
branch = True
26+
source = .
27+
omit =
28+
**/tmp/**
29+
./tmp/**/*
30+
31+
[coverage:report]
32+
omit =
33+
**/tmp/**
34+
./tmp/**/*

0 commit comments

Comments
 (0)