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:
88
88
return False
89
89
else :
90
90
return False
91
- except NameError :
91
+ except ( ImportError , NameError ) :
92
92
return False
Original file line number Diff line number Diff line change 5
5
# SPDX-License-Identifier: Apache-2.0
6
6
7
7
import re
8
-
8
+ from unittest . mock import patch , PropertyMock
9
9
10
10
def test_list_packages ():
11
11
from sasctl .utils .misc import installed_packages
@@ -18,3 +18,13 @@ def test_list_packages():
18
18
re .match ("sasctl.*" , p ) for p in packages
19
19
) # sasctl may be installed from disk so no '=='
20
20
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