diff --git a/.github/workflows/tests-python.yaml b/.github/workflows/tests-python.yaml index fdb5132d..48cabe01 100644 --- a/.github/workflows/tests-python.yaml +++ b/.github/workflows/tests-python.yaml @@ -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: @@ -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 }} diff --git a/.gitignore b/.gitignore index 2a30d1d6..9d864646 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,12 @@ __pycache__/ dist/ dbt.log +coverage.xml .coverage +.coverage.* build .tox .noai .DS_Store + +recce.yml diff --git a/Makefile b/Makefile index f8525cf9..e94305d8 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/tests/test_cli.py b/tests/test_cli.py index 013257ba..4382f17e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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 @@ -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() diff --git a/tox.ini b/tox.ini index 1720bb32..a0638c1b 100644 --- a/tox.ini +++ b/tox.ini @@ -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