Skip to content

[ET] Fix pytest for export tests #12835

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,31 @@
export management.
"""

from .export import export, ExportSession
from .export import (
EdgeTransformAndLowerStage,
ExecutorchStage,
export,
ExportSession,
ExportStage,
QuantizeStage,
SourceTransformStage,
)
from .recipe import ExportRecipe, QuantizationRecipe, RecipeType
from .recipe_provider import BackendRecipeProvider
from .recipe_registry import recipe_registry


__all__ = [
"EdgeTransformAndLowerStage",
"ExecutorchStage",
"ExportRecipe",
"QuantizationRecipe",
"ExportSession",
"ExportStage",
"export",
"QuantizationRecipe",
"QuantizeStage",
"BackendRecipeProvider",
"recipe_registry",
"RecipeType",
"SourceTransformStage",
]
23 changes: 12 additions & 11 deletions export/tests/test_export_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@

import torch
from executorch.exir.program import EdgeProgramManager, ExecutorchProgramManager
from executorch.export import ExportRecipe, QuantizationRecipe
from executorch.export.export import (
from executorch.export import (
EdgeTransformAndLowerStage,
ExecutorchStage,
ExportRecipe,
ExportSession,
ExportStage,
QuantizationRecipe,
QuantizeStage,
SourceTransformStage,
)
Expand Down Expand Up @@ -263,7 +264,7 @@ def test_export_session_full_quantization_pipeline(self) -> None:
actual_stages = [stage.name for stage in session._pipeline]
self.assertEqual(actual_stages, expected_stages)

@patch("executorch.export.export.ExportSession._run_pipeline")
@patch("executorch.export.ExportSession._run_pipeline")
def test_export_session_export_calls_pipeline(
self, mock_run_pipeline: Mock
) -> None:
Expand Down Expand Up @@ -369,9 +370,9 @@ def setUp(self) -> None:
self.model = SimpleTestModel()
self.example_inputs = [(torch.randn(2, 10),)]

@patch("executorch.export.export.ExecutorchStage")
@patch("executorch.export.export.EdgeTransformAndLowerStage")
@patch("executorch.export.export.ExportStage")
@patch("executorch.export.ExecutorchStage")
@patch("executorch.export.EdgeTransformAndLowerStage")
@patch("executorch.export.ExportStage")
def test_pipeline_execution_order_fp32(
self,
mock_export_stage_class: Mock,
Expand Down Expand Up @@ -412,10 +413,10 @@ def test_pipeline_execution_order_fp32(
mock_edge_stage.run.assert_called_once()
mock_executorch_stage.run.assert_called_once()

@patch("executorch.export.export.ExecutorchStage")
@patch("executorch.export.export.EdgeTransformAndLowerStage")
@patch("executorch.export.export.ExportStage")
@patch("executorch.export.export.QuantizeStage")
@patch("executorch.export.ExecutorchStage")
@patch("executorch.export.EdgeTransformAndLowerStage")
@patch("executorch.export.ExportStage")
@patch("executorch.export.QuantizeStage")
def test_pipeline_execution_order_quantized(
self,
mock_quantize_stage_class: Mock,
Expand Down Expand Up @@ -474,7 +475,7 @@ def setUp(self) -> None:
self.model = SimpleTestModel()
self.example_inputs = [(torch.randn(2, 10),)]

@patch("executorch.export.export.ExportSession")
@patch("executorch.export.ExportSession")
def test_export_function_creates_session_and_exports(
self, mock_session_class: Mock
) -> None:
Expand Down
1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ addopts =
exir/tests/
# executorch/export
export/tests
--ignore=export/tests/test_export_stages.py
# kernels/
kernels/prim_ops/test
kernels/quantized
Expand Down
Loading