Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Oct 29, 2024
1 parent cce9026 commit 426f974
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions executorlib/standalone/cache/queue.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess
from typing import List, Optional, Union

from pysqa import QueueAdapter
Expand Down
34 changes: 34 additions & 0 deletions tests/test_pysqa_subprocess.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import unittest

try:
from executorlib.standalone.cache.queue import _pysqa_execute_command

skip_pysqa_test = False
except ImportError:
skip_pysqa_test = True


@unittest.skipIf(
skip_pysqa_test, "pysqa is not installed, so the pysqa tests are skipped."
)
class TestPysqaExecuteCommand(unittest.TestCase):
def test_pysqa_execute_command_echo(self):
out = _pysqa_execute_command(
commands=["echo", "test"],
working_directory=None,
split_output=True,
shell=False,
error_filename="pysqa.err",
)
self.assertEqual(len(out), 2)
self.assertEqual("test", out[0])

def test_pysqa_execute_command_fail(self):
with self.assertRaises(FileNotFoundError):
_pysqa_execute_command(
commands=["no/executable/available"],
working_directory=None,
split_output=True,
shell=False,
error_filename="pysqa.err",
)

0 comments on commit 426f974

Please sign in to comment.