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

Issue: Refactoring Changes Breaking the Tests #8217

Closed
naveentatikonda opened this issue Jul 25, 2023 · 1 comment
Closed

Issue: Refactoring Changes Breaking the Tests #8217

naveentatikonda opened this issue Jul 25, 2023 · 1 comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder

Comments

@naveentatikonda
Copy link
Contributor

naveentatikonda commented Jul 25, 2023

Issue you'd like to raise.

The refactoring changes in this PR which changed the path of files from langchain/* to libs/langchain/langchain/*. But, the corresponding import statements are not refactored which is causing the tests to fail during local development.

Also, in that PR they added a new GitHub workflow which sets the working directory path to libs/langchian to run the unit tests in that path as part of CI. But, wondering how do we run them on the local machine. Also, the CI doesn't cover the integration tests, so how do we validate them after adding new tests.

Suggestion:

Please provide if there is any alternative way to run them and also update the corresponding documentation. Thanks!

@hwchase17 @baskaryan

@dosubot dosubot bot added 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder labels Jul 25, 2023
@dosubot
Copy link

dosubot bot commented Jul 25, 2023

Answer generated by a 🤖

Answer

I understand that you're having trouble with the refactoring changes in a recent pull request, which have caused the tests to fail during local development. This is due to the path of files being changed from langchain/* to libs/langchain/langchain/*, but the corresponding import statements were not updated. You're also unsure about how to run the tests locally and validate them, as the new GitHub workflow only covers unit tests and not integration tests.

To address your issue, you can run the unit tests locally by navigating to the libs/langchain directory and using the make test command. This command utilizes the pytest Python testing tool to execute the tests located in the tests/unit_tests/ directory. If you wish to run a specific test file, you can specify the path to the file using the TEST_FILE variable like this: make test TEST_FILE=tests/unit_tests/my_test_file.py.

For the integration tests, you can use the make integration_tests command, which also uses pytest to run the tests located in the tests/integration_tests/ directory.

Here are the commands for your reference:

# Run all unit tests
make test

# Run a specific unit test file
make test TEST_FILE=tests/unit_tests/my_test_file.py

# Run all integration tests
make integration_tests

As for the import statements that were not refactored, you'll need to manually update them in your test files to match the new file paths. For instance, if a file was moved from langchain/my_file.py to libs/langchain/langchain/my_file.py, you should update the import statement from import langchain.my_file to import libs.langchain.langchain.my_file.

While the CI currently doesn't cover the integration tests, it's important to manually run them after adding new tests to ensure they pass. You might also want to consider updating the CI workflow to include the integration tests.

This is one potential solution to your issue. If you find this solution correct and believe it's a bug that could impact other users, I encourage you to make a pull request with the necessary changes. If this solution doesn't align with your experience, I recommend upgrading to the latest version of LangChain to see if the issue persists.

Sources


This response is meant to be useful, save you time, and share context. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature 🤖:docs Changes to documentation and examples, like .md, .rst, .ipynb files. Changes to the docs/ folder
Projects
None yet
Development

No branches or pull requests

1 participant