Skip to content

Commit

Permalink
Add unit tests for init
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Sep 26, 2024
1 parent 9fd4991 commit faeca5a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions sedr/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Unit tests for __init__.py."""

import unittest
import subprocess
import sys

class TestInit(unittest.TestCase):

def test_version(self):
result = subprocess.run([sys.executable, "./__init__.py", "--version"], capture_output=True, text=True)
self.assertIn("v", result.stdout)

def test_help(self):
result = subprocess.run([sys.executable, "./__init__.py", "--help"], capture_output=True, text=True)
self.assertIn("usage:", result.stdout)

def test_run(self):
result = subprocess.run([sys.executable, "./__init__.py", "--url", "https://edrisobaric.k8s.met.no"], capture_output=True, text=True)
self.assertEqual(0, result.returncode)


if __name__ == "__main__":
unittest.main()
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ change_dir = sedr
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-dev.txt
commands = python -m unittest -v test_util
commands = python -m unittest -v test_util test_init

[testenv:prospector]
description = Run static analysis using prospector, but dont fail on errors
Expand Down

0 comments on commit faeca5a

Please sign in to comment.