Skip to content
Snippets Groups Projects
Commit abe6d9a3 authored by Garrett Bates's avatar Garrett Bates
Browse files

Merge branch 'unit_tests' into 'master'

Unit tests

See merge request passoft/fixhdr!6
parents d6ebc89f f3c06d00
No related branches found
No related tags found
1 merge request!6Unit tests
Pipeline #938 passed with stage
in 47 seconds
......@@ -27,6 +27,7 @@ linting:
stage: test
script:
- flake8 --ignore=F403,F405,F821,F841,W504 fixhdr
- flake8 tests
python3.6:
image: python:3.6
......
......@@ -4,21 +4,22 @@
"""Tests for `fixhdr` package."""
import unittest
import sys
try:
import fixhdr
except ImportError:
pass
from unittest.mock import patch
class TestFixhdr(unittest.TestCase):
"""Tests for `fixhdr` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"""Tear down test fixtures, if any."""
def test_import(self):
self.assertTrue('fixhdr' in sys.modules, "Fixhdr import failed!")
"""Test fixhdr import"""
with patch("sys.argv", ["fixhdr", "-#"]):
with self.assertRaises(SystemExit) as cmd:
try:
import fixhdr.fixhdr as fx
fx.Usage()
except ImportError as e:
print(e)
self.fail("fixhdr import failed")
self.assertEqual(cmd.exception.code, 0, "sys.exit(0) never called "
"- Failed to exercise fixhdr")
......@@ -5,6 +5,7 @@ envlist = py36, py37, py38, flake8
basepython = python
deps = flake8
commands = flake8 --ignore=F403,F405,F821,F841,W504 fixhdr
flake8 tests
[testenv]
commands = python -m unittest
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment