File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -88,5 +88,5 @@ def check_if_jupyter() -> bool:
8888 return False
8989 else :
9090 return False
91- except NameError :
91+ except ( ImportError , NameError ) :
9292 return False
Original file line number Diff line number Diff line change 55# SPDX-License-Identifier: Apache-2.0
66
77import re
8-
8+ from unittest . mock import patch , PropertyMock
99
1010def test_list_packages ():
1111 from sasctl .utils .misc import installed_packages
@@ -18,3 +18,13 @@ def test_list_packages():
1818 re .match ("sasctl.*" , p ) for p in packages
1919 ) # sasctl may be installed from disk so no '=='
2020 assert any (re .match ("pytest==.*" , p ) for p in packages )
21+
22+
23+ def test_check_if_jupyter ():
24+ """
25+ Test Cases:
26+ - can't mock get_ipython() attributes; so only test for ImportError or NameError
27+ """
28+ from sasctl .utils .misc import check_if_jupyter
29+
30+ assert not check_if_jupyter ()
You can’t perform that action at this time.
0 commit comments