File tree 2 files changed +8
-3
lines changed 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change
1
+ import platform
1
2
import sys
2
3
3
4
if sys .platform != "win32" :
4
5
import readline
5
6
6
7
original_ps1 = ">>> "
7
8
use_shell_integration = sys .version_info < (3 , 13 )
9
+ is_wsl = "microsoft-standard-WSL" in platform .release ()
8
10
9
11
10
12
class REPLHooks :
@@ -73,5 +75,5 @@ def __str__(self):
73
75
return result
74
76
75
77
76
- if sys .platform != "win32" and use_shell_integration :
78
+ if sys .platform != "win32" and ( not is_wsl ) and use_shell_integration :
77
79
sys .ps1 = PS1 ()
Original file line number Diff line number Diff line change 1
1
import importlib
2
+ import platform
2
3
import sys
3
4
from unittest .mock import Mock
4
5
5
6
import pythonrc
6
7
8
+ is_wsl = "microsoft-standard-WSL" in platform .release ()
9
+
7
10
8
11
def test_decoration_success ():
9
12
importlib .reload (pythonrc )
10
13
ps1 = pythonrc .PS1 ()
11
14
12
15
ps1 .hooks .failure_flag = False
13
16
result = str (ps1 )
14
- if sys .platform != "win32" :
17
+ if sys .platform != "win32" and ( not is_wsl ) :
15
18
assert (
16
19
result
17
20
== "\x1b ]633;E;None\x07 \x1b ]633;D;0\x07 \x1b ]633;A\x07 >>> \x1b ]633;B\x07 \x1b ]633;C\x07 "
@@ -26,7 +29,7 @@ def test_decoration_failure():
26
29
27
30
ps1 .hooks .failure_flag = True
28
31
result = str (ps1 )
29
- if sys .platform != "win32" :
32
+ if sys .platform != "win32" and ( not is_wsl ) :
30
33
assert (
31
34
result
32
35
== "\x1b ]633;E;None\x07 \x1b ]633;D;1\x07 \x1b ]633;A\x07 >>> \x1b ]633;B\x07 \x1b ]633;C\x07 "
You can’t perform that action at this time.
0 commit comments