-
Notifications
You must be signed in to change notification settings - Fork 16k
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
core[patch], langchain[patch]: fix required deps #14373
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
60ada41
core[patch]: specify anyio dep
baskaryan 1950115
poetry
baskaryan 2d54b01
test
baskaryan fb47535
rm unused
baskaryan 4da0d29
not unused
baskaryan 3feb35c
compile
baskaryan 5a435aa
tests
baskaryan df39d76
optional
baskaryan a6d91e6
pyyaml
baskaryan 1feacd1
typing
baskaryan d8716f2
jinja
baskaryan 0db9786
nit
baskaryan c9ac773
more
baskaryan f167f64
ci
baskaryan 95ca134
try/except
baskaryan 405b271
pydantic compat
baskaryan 94cabdf
google
baskaryan 27db93b
more
baskaryan b3a6c0a
poetry
baskaryan 66cc5ae
exp
baskaryan 3351694
ci
baskaryan cc1c255
more
baskaryan 6f7fc12
tot
baskaryan 567d620
nit
baskaryan af9ce99
rm try/except
baskaryan 90eac11
add back
baskaryan 7c0f499
extended tests
baskaryan b573559
poetry
baskaryan 9c43c36
conftest
baskaryan 57a1b92
poetry
baskaryan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import pytest | ||
|
||
|
||
@pytest.mark.compile | ||
def test_placeholder() -> None: | ||
"""Used for compiling integration tests without running any real tests.""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
"""Configuration for unit tests.""" | ||
from importlib import util | ||
from typing import Dict, Sequence | ||
|
||
import pytest | ||
from pytest import Config, Function, Parser | ||
|
||
|
||
def pytest_addoption(parser: Parser) -> None: | ||
"""Add custom command line options to pytest.""" | ||
parser.addoption( | ||
"--only-extended", | ||
action="store_true", | ||
help="Only run extended tests. Does not allow skipping any extended tests.", | ||
) | ||
parser.addoption( | ||
"--only-core", | ||
action="store_true", | ||
help="Only run core tests. Never runs any extended tests.", | ||
) | ||
|
||
|
||
def pytest_collection_modifyitems(config: Config, items: Sequence[Function]) -> None: | ||
"""Add implementations for handling custom markers. | ||
|
||
At the moment, this adds support for a custom `requires` marker. | ||
|
||
The `requires` marker is used to denote tests that require one or more packages | ||
to be installed to run. If the package is not installed, the test is skipped. | ||
|
||
The `requires` marker syntax is: | ||
|
||
.. code-block:: python | ||
|
||
@pytest.mark.requires("package1", "package2") | ||
def test_something(): | ||
... | ||
""" | ||
# Mapping from the name of a package to whether it is installed or not. | ||
# Used to avoid repeated calls to `util.find_spec` | ||
required_pkgs_info: Dict[str, bool] = {} | ||
|
||
only_extended = config.getoption("--only-extended") or False | ||
only_core = config.getoption("--only-core") or False | ||
|
||
if only_extended and only_core: | ||
raise ValueError("Cannot specify both `--only-extended` and `--only-core`.") | ||
|
||
for item in items: | ||
requires_marker = item.get_closest_marker("requires") | ||
if requires_marker is not None: | ||
if only_core: | ||
item.add_marker(pytest.mark.skip(reason="Skipping not a core test.")) | ||
continue | ||
|
||
# Iterate through the list of required packages | ||
required_pkgs = requires_marker.args | ||
for pkg in required_pkgs: | ||
# If we haven't yet checked whether the pkg is installed | ||
# let's check it and store the result. | ||
if pkg not in required_pkgs_info: | ||
try: | ||
installed = util.find_spec(pkg) is not None | ||
except Exception: | ||
installed = False | ||
required_pkgs_info[pkg] = installed | ||
|
||
if not required_pkgs_info[pkg]: | ||
if only_extended: | ||
pytest.fail( | ||
f"Package `{pkg}` is not installed but is required for " | ||
f"extended tests. Please install the given package and " | ||
f"try again.", | ||
) | ||
|
||
else: | ||
# If the package is not installed, we immediately break | ||
# and mark the test as skipped. | ||
item.add_marker( | ||
pytest.mark.skip(reason=f"Requires pkg: `{pkg}`") | ||
) | ||
break | ||
else: | ||
if only_extended: | ||
item.add_marker( | ||
pytest.mark.skip(reason="Skipping not an extended test.") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
"Run", | ||
"RunLog", | ||
"RunLogPatch", | ||
"LogStreamCallbackHandler", | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was linting messing up somehow?