Skip to content
Snippets Groups Projects
Commit 2c28e537 authored by Maeva Pourpoint's avatar Maeva Pourpoint
Browse files

Add unit tests to ensure code basic functionalities

parent 4a8fb22b
No related branches found
No related tags found
1 merge request!5Unit tests
Pipeline #896 passed with stage
in 42 seconds
......@@ -27,6 +27,7 @@ linting:
stage: test
script:
- flake8 --ignore=F403,F405,F821,F841,W504 mseedpeek
- flake8 tests
python3.6:
image: python:3.6
......
......@@ -4,21 +4,18 @@
"""Tests for `mseedpeek` package."""
import unittest
import sys
try:
import mseedpeek
except ImportError:
pass
from unittest.mock import patch
from mseedpeek.mseedpeek import main
class TestMseedpeek(unittest.TestCase):
"""Tests for `mseedpeek` 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('mseedpeek' in sys.modules, "Mseedpeek import failed!")
"""Test mseedpeek import"""
with patch('sys.argv', ['mseedpeek', '-#']):
with self.assertRaises(SystemExit) as cmd:
main()
self.assertEqual(cmd.exception.code, 0, "sys.exit(0) never called "
"- Failed to exercise mseedpeek")
......@@ -5,6 +5,7 @@ envlist = py36, py37, py38, flake8
basepython = python
deps = flake8
commands = flake8 --ignore=F403,F405,F821,F841,W504 mseedpeek
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