18 lines
566 B
Python
18 lines
566 B
Python
import shutil
|
|
import subprocess
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
|
|
class PiAdapterTests(unittest.TestCase):
|
|
@unittest.skipUnless(shutil.which('node'), 'Node is not installed')
|
|
def test_node_adapter(self):
|
|
root = Path(__file__).resolve().parents[1]
|
|
result = subprocess.run(['node', '--test', 'tests/test_pi_adapter.mjs'],
|
|
cwd=root, capture_output=True, text=True, timeout=45)
|
|
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|