@@ -137,6 +137,7 @@ def read(fd):
137
137
stderr = slave_fd ,
138
138
text = True ,
139
139
env = env ,
140
+ preexec_fn = os .setsid ,
140
141
)
141
142
# Wait for the shell to start and get to the prompt
142
143
print (read (master_fd ))
@@ -151,6 +152,8 @@ def read(fd):
151
152
152
153
os .write (master_fd , b"\t \t " )
153
154
155
+ time .sleep (0.5 )
156
+
154
157
# Read the output
155
158
output = read_all_from_fd_with_timeout (master_fd , 3 )
156
159
@@ -267,12 +270,13 @@ def verify_remove(self, script=None):
267
270
268
271
269
272
@pytest .mark .skipif (shutil .which ("bash" ) is None , reason = "Bash not available" )
270
- class BashExeShellTests (_InstalledScriptTestCase , TestCase ):
271
- pass
273
+ class BashExeShellTests (_InstalledScriptTestCase , BashShellTests ):
274
+
275
+ shell = "bash"
272
276
273
277
274
278
@pytest .mark .skipif (shutil .which ("fish" ) is None , reason = "Fish not available" )
275
- class _FishShellTests (_DefaultCompleteTestCase , TestCase ):
279
+ class FishShellTests (_DefaultCompleteTestCase ): # , TestCase):
276
280
"""
277
281
TODO this test is currently disabled because fish completion installation does
278
282
not seem to work for scripts not on the path.
@@ -288,7 +292,6 @@ def set_environment(self, fd):
288
292
fd ,
289
293
f'export DJANGO_SETTINGS_MODULE={ os .environ ["DJANGO_SETTINGS_MODULE" ]} \n ' .encode (),
290
294
)
291
- os .write (fd , f"source .venv/bin/activate\n " .encode ())
292
295
293
296
def verify_install (self , script = None ):
294
297
if not script :
@@ -300,10 +303,20 @@ def verify_remove(self, script=None):
300
303
script = self .manage_script
301
304
self .assertFalse ((self .directory / f"{ script } .fish" ).exists ())
302
305
306
+ def test_shell_complete (self ):
307
+ # just verify that install/remove works. The actual completion is not tested
308
+ # because there's an issue running fish interactively in a pty:
309
+ # warning: No TTY for interactive shell (tcgetpgrp failed)
310
+ # setpgid: Inappropriate ioctl for device
311
+ # TODO - fix this
312
+ self .install ()
313
+ self .remove ()
314
+
303
315
304
316
@pytest .mark .skipif (shutil .which ("fish" ) is None , reason = "Fish not available" )
305
- class FishExeShellTests (_InstalledScriptTestCase , TestCase ):
306
- pass
317
+ class FishExeShellTests (_InstalledScriptTestCase , FishShellTests , TestCase ):
318
+
319
+ shell = "fish"
307
320
308
321
309
322
@pytest .mark .skipif (shutil .which ("pwsh" ) is None , reason = "Powershell not available" )
0 commit comments