Skip to content
Open
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
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ test_watch:
integration_test integration_tests:
poetry run pytest $(TEST_FILE)

coverage:
poetry run coverage run --source=langchain_hana -m pytest $(TEST_FILE)
poetry run coverage html
@echo 'Coverage report generated in htmlcov/index.html. Open this file in your browser to view the coverage.'

######################
# LINTING AND FORMATTING
######################
Expand Down Expand Up @@ -64,3 +69,4 @@ help:
@echo 'integration_test TEST_FILE=<test_file> - run integration tests in a file'
@echo 'lint_diff - lint only files changed since the last commit'
@echo 'format_diff - format only files changed since the last commit'
@echo 'coverage - run tests with coverage measurement and generate an HTML report'
46 changes: 44 additions & 2 deletions docs/setup_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,57 @@ To set up the development environment, follow these steps:
3. Run the following command to install all necessary dependencies:

```bash
poetry install --with lint,typing,test,test_integration
poetry install --with lint,typing,test,test_integration,coverage
```

This command installs dependencies for development, including those for linting, formatting, spell-checking, and testing.
This command installs dependencies for development, including those for linting, formatting, spell-checking, testing, and coverage.

4. You are now ready to work on the package!

---

## Running Tests with Coverage

To ensure code quality and test coverage, you can generate a coverage report for the project. Follow these steps:

1. Run the following command to execute tests and generate a coverage report:

```bash
make coverage
```

2. After running the command, an HTML coverage report will be generated in the `htmlcov` directory. Open the `htmlcov/index.html` file in your browser to view the coverage details.

This ensures that all parts of the code are adequately tested and helps identify untested areas.

---

## Viewing Coverage Report Locally

After generating the coverage report, you can serve it locally using Python's built-in HTTP server. This allows you to view the report in your browser without manually opening the file.

1. Navigate to the `htmlcov` directory:

```bash
cd htmlcov
```

2. Start a local HTTP server using Python:

```bash
python3 -m http.server
```

3. Open your browser and go to the following URL to view the coverage report:

```
http://localhost:8000
```

This will serve the `htmlcov` directory on port 8000, making it easy to access the coverage report.

---

## Additional Tips

- **Creating Distribution Artifacts**
Expand Down
88 changes: 82 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ disallow_untyped_defs = "True"
python = ">=3.9,<4.0"
langchain-core = "^0.3.15"
hdbcli = "^2.23.24"
coverage = "^7.8.0"

[[tool.poetry.dependencies.numpy]]
version = "^1"
Expand Down