mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
09f9464254
This makes it easy to run the tests locally. Some tests may not be able to run in `Windows` environments, hence the need for a `Dockerfile`. The new `Dockerfile` sets up a multi-stage build to install Poetry and dependencies, and then copies the project code to a final image for tests. The `Makefile` has been updated to include a new 'docker_tests' target that builds the Docker image and runs the `unit tests` inside a container. It would be beneficial to offer a local testing environment for developers by enabling them to run a Docker image on their local machines with the required dependencies, particularly for integration tests. While this is not included in the current PR, it would be straightforward to add in the future. This pull request lacks documentation of the changes made at this moment.
59 lines
1.4 KiB
Makefile
59 lines
1.4 KiB
Makefile
.PHONY: all clean format lint test tests test_watch integration_tests docker_tests help
|
|
|
|
all: help
|
|
|
|
coverage:
|
|
poetry run pytest --cov \
|
|
--cov-config=.coveragerc \
|
|
--cov-report xml \
|
|
--cov-report term-missing:skip-covered
|
|
|
|
clean: docs_clean
|
|
|
|
docs_build:
|
|
cd docs && poetry run make html
|
|
|
|
docs_clean:
|
|
cd docs && poetry run make clean
|
|
|
|
docs_linkcheck:
|
|
poetry run linkchecker docs/_build/html/index.html
|
|
|
|
format:
|
|
poetry run black .
|
|
poetry run ruff --select I --fix .
|
|
|
|
lint:
|
|
poetry run mypy .
|
|
poetry run black . --check
|
|
poetry run ruff .
|
|
|
|
test:
|
|
poetry run pytest tests/unit_tests
|
|
|
|
tests:
|
|
poetry run pytest tests/unit_tests
|
|
|
|
test_watch:
|
|
poetry run ptw --now . -- tests/unit_tests
|
|
|
|
integration_tests:
|
|
poetry run pytest tests/integration_tests
|
|
|
|
docker_tests:
|
|
docker build -t my-langchain-image:test .
|
|
docker run --rm my-langchain-image:test
|
|
|
|
help:
|
|
@echo '----'
|
|
@echo 'coverage - run unit tests and generate coverage report'
|
|
@echo 'docs_build - build the documentation'
|
|
@echo 'docs_clean - clean the documentation build artifacts'
|
|
@echo 'docs_linkcheck - run linkchecker on the documentation'
|
|
@echo 'format - run code formatters'
|
|
@echo 'lint - run linters'
|
|
@echo 'test - run unit tests'
|
|
@echo 'test_watch - run unit tests in watch mode'
|
|
@echo 'integration_tests - run integration tests'
|
|
@echo 'docker_tests - run unit tests in docker'
|