Skip to content

Commit 4a5a1e2

Browse files
committed
resolve comments
1 parent d084891 commit 4a5a1e2

File tree

7 files changed

+37
-28
lines changed

7 files changed

+37
-28
lines changed

.github/workflows/build-test-linux-x86_64.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,32 @@ jobs:
101101
export CI_BUILD=1
102102
export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH
103103
pushd .
104-
cd tests/py
105-
python -m pip install -r requirements.txt
104+
python -m pip install -r tests/py/requirements.txt
105+
cov_param="--cov=torch_tensorrt --cov-report= --cov-config=pyproject.toml"
106+
107+
# test dynamo backend
108+
python -m pytest -m critical ${cov_param} -n 4 tests/py/dynamo/backend/
109+
110+
# test dynamo models
111+
python -m pytest -m critical ${cov_param} -ra --cov-append --ir dynamo tests/py/dynamo/models/
106112
107-
# test dynamo
108-
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_backend_test_results.xml -n 4 dynamo/backend/
109-
python -m pytest -m critical -ra --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_models_result.xml --ir dynamo dynamo/models/
110-
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_automatic_plugin_results.xml dynamo/automatic_plugin/
111-
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_partitioning_results.xml dynamo/partitioning/
112-
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_lowering_results.xml dynamo/lowering/
113-
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_runtime_results.xml dynamo/runtime/
113+
# test dynamo automatic plugin
114+
python -m pytest -m critical ${cov_param} --cov-append tests/py/dynamo/automatic_plugin/
114115
116+
# test dynamo partitioning
117+
python -m pytest -m critical ${cov_param} --cov-append tests/py/dynamo/partitioning/
118+
119+
# test dynamo lowering
120+
python -m pytest -m critical ${cov_param} --cov-append tests/py/dynamo/lowering/
121+
122+
# test dynamo runtime
123+
python -m pytest ${cov_param} --cov-append tests/py/dynamo/runtime/test_000_*
124+
python -m pytest -m critical ${cov_param} --cov-append --ignore tests/py/dynamo/runtime/test_000_* tests/py/dynamo/runtime/
125+
115126
# test core
116-
python -m pytest -m critical --junitxml=${RUNNER_TEST_RESULTS_DIR}/core_test_results.xml core/
117-
popd
127+
python -m pytest -m critical ${cov_param} --cov-append tests/py/core/
128+
129+
coverage report --fail-under=20
118130
119131
tests-py-torchscript-fe:
120132
name: Test torchscript frontend [Python]

pyproject.toml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ dev = [
7777
"isort",
7878
"ruff",
7979
"pytest",
80+
"pytest-cov",
8081
"pytest-xdist",
8182
"parameterized>=0.2.0",
8283
"expecttest==0.1.6",
@@ -102,25 +103,22 @@ Changelog = "https://github.com/pytorch/tensorrt/releases"
102103
package-dir = { "" = "py" }
103104
include-package-data = false
104105

105-
[tool.pytest.ini_options]
106-
testpaths = ["tests/py"]
107-
addopts = "-ra --cov=py/torch_tensorrt --cov-report=html --cov-report=xml:coverage.xml --cov-config=pyproject.toml"
108-
109106
[tool.coverage.paths]
110107
source = [
111-
"py/torch_tensorrt/",
112-
"*/site-packages/torch_tensorrt/"
108+
"py/torch_tensorrt",
109+
"*/site-packages/torch_tensorrt"
113110
]
111+
112+
[tool.coverage.run]
113+
source = ["torch_tensorrt"]
114114
omit = [
115115
"tests/*"
116116
]
117-
118-
[tool.coverage.run]
117+
data_file=".coverage"
119118
relative_files=true
120119
branch = true
121120

122121
[tool.coverage.report]
123-
fail_under = 20
124122
skip_covered = true
125123
ignore_errors = true
126124
exclude_lines = [
@@ -143,9 +141,6 @@ exclude_lines = [
143141
"@(abc\\.)?abstractmethod",
144142
]
145143

146-
[tool.coverage.html]
147-
directory = "coverage_html"
148-
149144
[tool.uv]
150145
package = true
151146
environments = ["sys_platform == 'linux'", "sys_platform == 'windows'"]

tests/py/dynamo/lowering/test_decompositions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
)
1010
from torch.testing._internal.common_utils import TestCase, run_tests
1111
from torch_tensorrt.dynamo.utils import ATOL, RTOL
12-
12+
import pytest
1313
from ..testing_utilities import DECIMALS_OF_AGREEMENT, lower_graph_testing
1414

1515

tests/py/dynamo/models/test_reexport.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def forward(self, x):
7171

7272

7373
@pytest.mark.unit
74+
@pytest.mark.critical
7475
def test_base_full_compile_multiple_outputs(ir):
7576
"""
7677
This tests export serde functionality on a base model

tests/py/dynamo/partitioning/test_fast_partitioning.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def forward(self, x, y):
8484
1,
8585
"All operators are supported, there should be one segment",
8686
)
87-
87+
@pytest.mark.critical
8888
def test_partition_partially_supported_multi_op(self):
8989
class PartiallySupportedMultiOp(torch.nn.Module):
9090
def __init__(self, *args, **kwargs) -> None:
@@ -114,6 +114,7 @@ def forward(self, x, y):
114114
"Unsupported operators interleave supported ones, expected 2 segments",
115115
)
116116

117+
@pytest.mark.critical
117118
def test_partition_partially_supported_with_torch_executed_ops(self):
118119
class PartiallySupportedMultiOp(torch.nn.Module):
119120
def __init__(self, *args, **kwargs) -> None:

tests/py/dynamo/runtime/test_000_convert_module_to_trt_engine.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import unittest
22

3-
import pytest
4-
import tensorrt as trt
53
import torch
64
import torch_tensorrt
75
from torch_tensorrt.dynamo.runtime import PythonTorchTensorRTModule
86
from torch_tensorrt.dynamo.utils import COSINE_THRESHOLD, cosine_similarity
97

8+
import tensorrt as trt
9+
1010

1111
class TestConvertModuleToTrtEngine(unittest.TestCase):
12-
@pytest.mark.critical
1312
def test_convert_module(self):
1413
class Test(torch.nn.Module):
1514
def forward(self, a, b):

tests/py/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ numpy
66
parameterized>=0.2.0
77
pytest>=8.2.1
88
pytest-xdist>=3.6.1
9+
pytest-cov
910
pyyaml
1011
timm>=1.0.3
1112
flashinfer-python; python_version < "3.13"

0 commit comments

Comments
 (0)