refactor: move tests folder structure and update pytest commands (#2785)
* refactor: move tests folder to src/backend * chore(Makefile): update pytest commands to run tests from the correct directory paths for unit and integration tests * refactor: update file path in test_custom_component.py The file path in the test_custom_component.py file has been updated to use the correct relative path to the component_multiple_outputs.py file. This change ensures that the test code can access the correct file and improves the reliability of the test.
This commit is contained in:
parent
afdff210b3
commit
0122a50a35
56 changed files with 5 additions and 5 deletions
6
Makefile
6
Makefile
|
|
@ -74,13 +74,13 @@ coverage: ## run the tests and generate a coverage report
|
|||
|
||||
# allow passing arguments to pytest
|
||||
unit_tests: ## run unit tests
|
||||
poetry run pytest \
|
||||
--ignore=tests/integration \
|
||||
poetry run pytest src/backend/tests \
|
||||
--ignore=src/backend/tests/integration \
|
||||
--instafail -ra -n auto -m "not api_key_required" \
|
||||
$(args)
|
||||
|
||||
integration_tests: ## run integration tests
|
||||
poetry run pytest tests/integration \
|
||||
poetry run pytest src/backend/tests/integration \
|
||||
--instafail -ra -n auto \
|
||||
$(args)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ from langflow.services.database.models.flow import Flow, FlowCreate
|
|||
|
||||
@pytest.fixture
|
||||
def code_component_with_multiple_outputs():
|
||||
with open("tests/data/component_multiple_outputs.py", "r") as f:
|
||||
with open("src/backend/tests/data/component_multiple_outputs.py", "r") as f:
|
||||
code = f.read()
|
||||
return Component(code=code)
|
||||
|
||||
|
|
@ -184,7 +184,7 @@ def test_directory_without_mocks():
|
|||
# check if the directory component can load them
|
||||
# just check if the number of results is the same as the number of files
|
||||
directory_component = data.DirectoryComponent()
|
||||
docs_path = Path(__file__).parent.parent.parent / "docs" / "docs" / "Components"
|
||||
docs_path = Path(__file__).parent.parent.parent.parent.parent / "docs" / "docs" / "Components"
|
||||
directory_component.set_attributes({"path": str(docs_path), "use_multithreading": False})
|
||||
results = directory_component.load_directory()
|
||||
docs_files = list(docs_path.glob("*.md")) + list(docs_path.glob("*.json"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue