Skip to content

Commit

Permalink
add test for importing and using dependencies
Browse files Browse the repository at this point in the history
- add `requirements.txt` file for dependencies for tests
- update ci to install these requirements
  • Loading branch information
brownben committed Nov 25, 2024
1 parent f508b82 commit bdd55e3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
with:
python-version: ${{ matrix.python_version }}
allow-prereleases: true
- name: Install Dependencies
run: pip install -r ./tests/requirements.txt
- name: Build
run: cargo build
- name: Test
Expand Down
1 change: 1 addition & 0 deletions tests/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ execution_test!(basic_function);
execution_test!(basic_method);
execution_test!(captures_stdout);
execution_test!(expected_error);
execution_test!(dependencies);
execution_test!(failing_test);
execution_test!(imports);
execution_test!(import_submodule, "package/import_submodule");
Expand Down
24 changes: 24 additions & 0 deletions tests/execution/dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
These tests test importing a dependency and using it in a test
From issue #1 (https://github.com/brownben/xc/issues/1)
- test_astroid: PASS
- test_yarl: PASS
"""

import astroid
from yarl import URL


def test_astroid():
source_code = """
def foo(bar: str) -> int:
return len(bar)
"""
tree = astroid.parse(source_code)
assert tree


def test_yarl():
foo = URL("http://foo.com/")
assert foo / "bar"
3 changes: 3 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Requirements for ./execution/dependencies.txt
astroid
yarl

0 comments on commit bdd55e3

Please sign in to comment.