Skip to content

Commit

Permalink
Fix import guards for tests
Browse files Browse the repository at this point in the history
Change-Id: Iaee06017bd125d3040ce42182c4ccdb80d7fc946
  • Loading branch information
mbaret committed Sep 9, 2021
1 parent fa62de7 commit c2895f6
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions tests/python/contrib/test_ethosu/test_attr_passing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=invalid-name, unused-argument
import pytest

pytest.importorskip("ethosu.vela")
import tvm
from tvm import relay
from tvm.relay.backend.contrib.ethosu import util
Expand All @@ -40,5 +41,4 @@ def test_compiler_attr_default():


if __name__ == "__main__":
test_compiler_attr()
test_compiler_attr_default()
pytest.main([__file__])
5 changes: 4 additions & 1 deletion tests/python/contrib/test_ethosu/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import pytest

pytest.importorskip("ethosu.vela")
import tvm
from tvm import relay
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_tir
Expand Down Expand Up @@ -42,4 +45,4 @@ def test_lower_to_tir():


if __name__ == "__main__":
test_lower_to_tir()
pytest.main([__file__])
4 changes: 2 additions & 2 deletions tests/python/contrib/test_ethosu/test_encode_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import numpy as np
import pytest

pytest.importorskip("ethosu.vela")
import tvm
from tvm import tir
from tvm import script
Expand All @@ -24,7 +25,6 @@
from tvm.relay.testing import run_opt_pass
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_tir
from tvm.relay.backend.contrib.ethosu.tir.scheduler import Convolution2DCompute
import pytest

from infra import make_ethosu_conv2d

Expand Down
6 changes: 4 additions & 2 deletions tests/python/contrib/test_ethosu/test_extract_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import pytest

pytest.importorskip("ethosu.vela")
import tvm
from tvm import relay
from tvm.relay.testing import run_opt_pass
Expand Down Expand Up @@ -93,5 +96,4 @@ def _expected():


if __name__ == "__main__":
test_extract_constants_single()
test_extract_constants_multi()
pytest.main([__file__])
6 changes: 3 additions & 3 deletions tests/python/contrib/test_ethosu/test_lower_to_te.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# pylint: disable=invalid-name, unused-argument
import pytest

pytest.importorskip("ethosu.vela")
import tvm
from tvm import relay
from tvm.relay.testing import run_opt_pass
from tvm.relay.backend.contrib.ethosu.tir.compiler import lower_to_te
from tvm.relay.backend.contrib.ethosu.tir.scheduler import Convolution2DCompute
import tvm.relay.backend.contrib.ethosu.op as ethosu_ops
Expand Down Expand Up @@ -60,4 +60,4 @@ def test_ethosu_conv2d():


if __name__ == "__main__":
test_ethosu_conv2d()
pytest.main([__file__])
4 changes: 2 additions & 2 deletions tests/python/contrib/test_ethosu/test_replace_conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import pytest

pytest.importorskip("ethosu.vela")
import tvm
import tvm.script
from tvm.script import tir, ty
Expand All @@ -24,8 +26,6 @@
from tvm.relay.backend.contrib.ethosu.tir.scheduler import total_cascader
from infra import make_ethosu_conv2d, get_convolutional_args

import pytest


@pytest.mark.parametrize(
"trial",
Expand Down
2 changes: 2 additions & 0 deletions tests/python/contrib/test_ethosu/test_replace_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.
import pytest

pytest.importorskip("ethosu.vela")
import tvm
import tvm.script
from tvm.script import tir, ty
Expand Down
12 changes: 4 additions & 8 deletions tests/python/contrib/test_ethosu/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import tvm
import pytest

pytest.importorskip("ethosu.vela")
from tvm import relay
from tvm.relay.testing import run_opt_pass
from tvm import te, topi
Expand Down Expand Up @@ -139,10 +141,4 @@ def test_schedule_cache_reads():


if __name__ == "__main__":
test_tile_nd()
test_schedule_pragmas()
test_schedule_pragmas_for_const()
test_inline_no_ops()
test_total_cascader()
test_copy_constants()
test_schedule_cache_reads()
pytest.main([__file__])

0 comments on commit c2895f6

Please sign in to comment.