Skip to content

Commit 515a4e4

Browse files
committed
punt on fish integration tests, just test install/remove
1 parent 28674fb commit 515a4e4

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Diff for: django_typer/tests/completion_tests.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def read(fd):
137137
stderr=slave_fd,
138138
text=True,
139139
env=env,
140+
preexec_fn=os.setsid,
140141
)
141142
# Wait for the shell to start and get to the prompt
142143
print(read(master_fd))
@@ -151,6 +152,8 @@ def read(fd):
151152

152153
os.write(master_fd, b"\t\t")
153154

155+
time.sleep(0.5)
156+
154157
# Read the output
155158
output = read_all_from_fd_with_timeout(master_fd, 3)
156159

@@ -267,12 +270,13 @@ def verify_remove(self, script=None):
267270

268271

269272
@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"
272276

273277

274278
@pytest.mark.skipif(shutil.which("fish") is None, reason="Fish not available")
275-
class _FishShellTests(_DefaultCompleteTestCase, TestCase):
279+
class FishShellTests(_DefaultCompleteTestCase): # , TestCase):
276280
"""
277281
TODO this test is currently disabled because fish completion installation does
278282
not seem to work for scripts not on the path.
@@ -288,7 +292,6 @@ def set_environment(self, fd):
288292
fd,
289293
f'export DJANGO_SETTINGS_MODULE={os.environ["DJANGO_SETTINGS_MODULE"]}\n'.encode(),
290294
)
291-
os.write(fd, f"source .venv/bin/activate\n".encode())
292295

293296
def verify_install(self, script=None):
294297
if not script:
@@ -300,10 +303,20 @@ def verify_remove(self, script=None):
300303
script = self.manage_script
301304
self.assertFalse((self.directory / f"{script}.fish").exists())
302305

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+
303315

304316
@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"
307320

308321

309322
@pytest.mark.skipif(shutil.which("pwsh") is None, reason="Powershell not available")

0 commit comments

Comments
 (0)