Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/drc 962 infra setup codecov for recce repo #536

Merged
merged 7 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/tests-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ on:
branches:
- main
paths:
- "recce/**"
- "recce/**" # Recce OSS codebase
- "tests/**" # Recce OSS python unit tests
pull_request:
branches:
- main
paths:
- "recce/**"
- "recce/**" # Recce OSS codebase
- "tests/**" # Recce OSS python unit tests
- "setup.py"

jobs:
Expand Down Expand Up @@ -44,3 +46,8 @@ jobs:
- name: Run tests
run: |
make test-tox

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ __pycache__/
dist/

dbt.log
coverage.xml
.coverage
.coverage.*
build
.tox
.noai
.DS_Store

recce.yml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ flake8:
@echo "Passed"

test: install-dev
@python3 -m pytest --cov=recce --cov-report html tests
@python3 -m pytest --cov --cov-report xml --cov-report html tests

test-tox: install-dev
@tox
Expand Down
16 changes: 15 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from click.testing import CliRunner

from recce.cli import server as cli_command_server
from recce.cli import server as cli_command_server, run as cli_command_run
from recce.core import RecceContext
from recce.state import RecceStateLoader

Expand Down Expand Up @@ -58,3 +58,17 @@ def test_cmd_server_with_cloud(self, mock_state_loader_class, mock_run, mock_get
self.runner.invoke(cli_command_server, ['--cloud', '--password', 'unittest', '--cloud-token', 'unittest'])
mock_state_loader_class.assert_called_once()
mock_run.assert_called_once()


class TestCommandRun(TestCase):
def setUp(self):
self.runner = CliRunner()
pass

@patch.object(RecceContext, 'verify_required_artifacts')
@patch('recce.cli.cli_run')
def test_cmd_run(self, mock_cli_run, mock_verify_required_artifacts):
mock_verify_required_artifacts.return_value = True, None

self.runner.invoke(cli_command_run, [])
mock_cli_run.assert_called_once()
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ basepython = python3.10

deps =
pytest
pytest-cov
pandas
duckdb<1.1
dbt1.5: dbt-duckdb==1.5.*
dbt1.6: dbt-duckdb==1.6.*
dbt1.7: dbt-duckdb==1.7.*
dbt1.8: dbt-duckdb==1.8.*
dbtlatest: dbt-duckdb

commands =
pytest
pytest --cov --cov-append --cov-report=xml

[testenv:clean]
deps = coverage
skip_install = true
commands = coverage erase
Loading