Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-yuwang committed Sep 17, 2024
1 parent e788125 commit c45ca1e
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/integ/test_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,17 @@ def single_value_sp(session: snowflake.snowpark.Session) -> str:
def test_not_set_profiler_error(session, tmpdir):
with pytest.raises(ValueError) as e:
session.show_profiles()
assert "profiler is not set, use session.register_profiler or profiler context manager" in str(e)
assert (
"profiler is not set, use session.register_profiler or profiler context manager"
in str(e)
)

with pytest.raises(ValueError) as e:
session.dump_profiles(tmpdir.join("file.txt"))
assert "profiler is not set, use session.register_profiler or profiler context manager" in str(e)
assert (
"profiler is not set, use session.register_profiler or profiler context manager"
in str(e)
)


@pytest.mark.skipif(
Expand All @@ -147,7 +153,10 @@ def test_set_incorrect_active_profiler():
pro = Profiler()
with pytest.raises(ValueError) as e:
pro.set_active_profiler("wrong_active_profiler")
assert "active_profiler expect 'LINE' or 'MEMORY', got wrong_active_profiler instead" in str(e)
assert (
"active_profiler expect 'LINE' or 'MEMORY', got wrong_active_profiler instead"
in str(e)
)


@pytest.mark.skipif(
Expand All @@ -156,6 +165,7 @@ def test_set_incorrect_active_profiler():
)
def test_dump_profile_to_file(session, db_parameters, tmpdir):
file = tmpdir.join("profile.lprof")

def single_value_sp(session: snowflake.snowpark.Session) -> str:
return "success"

Expand All @@ -169,5 +179,5 @@ def single_value_sp(session: snowflake.snowpark.Session) -> str:
single_value_sp()
session.dump_profiles(file)
session.register_profiler_modules([])
with open(file, "r") as f:
with open(file) as f:
assert "Modules Profiled" in f.read()

0 comments on commit c45ca1e

Please sign in to comment.