Skip to content
Merged
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "tilelens"
version = "3.1"
version = "3.1.1"
description = "A visualization tool for Triton"
authors = [
{name = "Deep Learning Profiling Tools Team", email = "kzhou6@gmu.edu"}
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/test_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import subprocess
import sys

import pytest
from unittest.mock import MagicMock, patch

Expand Down Expand Up @@ -246,3 +249,10 @@ def test_apply_wrapper_rejects_non_cli_invocation():
apply_sanitizer()
with pytest.raises(RuntimeError, match="must be used as a CLI tool"):
apply_profiler()


def test_wrapper_imports_without_pytest():
"""The CLIs import tilelens.wrapper; pytest is only a test extra."""
code = "import sys; sys.modules['pytest'] = None; import tilelens.wrapper"
proc = subprocess.run([sys.executable, "-c", code], capture_output=True, text=True)
assert proc.returncode == 0, proc.stderr
5 changes: 4 additions & 1 deletion tilelens/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import shutil
import runpy
import sys
import pytest
import triton
import tilelens
from triton.experimental import gluon as _gluon
Expand Down Expand Up @@ -132,6 +131,10 @@ def _apply_wrapper(wrapper_func, command_name, usage_msg):
# Check if it's an executable command
if shutil.which(cmd[0]):
if cmd[0] == "pytest":
# pytest is only a test extra; import it just for this branch
# so the CLIs work in a plain `pip install tilelens`.
import pytest

sys.exit(pytest.main(cmd[1:]))
elif cmd[0] == "python":
sys.argv = cmd[1:]
Expand Down
Loading