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

Add unit tests to ensure code basic functionalities

parent 795e626c
No related branches found
No related tags found
1 merge request!11Unit tests
Pipeline #881 passed with stage
in 44 seconds
...@@ -27,6 +27,7 @@ linting: ...@@ -27,6 +27,7 @@ linting:
stage: test stage: test
script: script:
- flake8 --ignore=F401,F811,W504 bline - flake8 --ignore=F401,F811,W504 bline
- flake8 tests
python3.6: python3.6:
image: python:3.6 image: python:3.6
......
...@@ -6,19 +6,18 @@ ...@@ -6,19 +6,18 @@
import unittest import unittest
import sys import sys
try: from unittest.mock import patch
import bline
except ImportError:
pass
class TestBline(unittest.TestCase): class TestBline(unittest.TestCase):
"""Tests for `bline` package.""" """Tests for `bline` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"""Tear down test fixtures, if any."""
def test_import(self): def test_import(self):
self.assertTrue('bline' in sys.modules, "Bline import failed!") """Test bline import"""
with patch.object(sys, 'argv', ['bline']):
with self.assertRaises(SystemExit):
try:
import bline.bline as bp
self.assertTrue(bp.PROG_NAME, 'BLINE')
except ImportError:
self.fail('Failed to import bline!')
...@@ -5,6 +5,7 @@ envlist = py36, py37, py38, flake8 ...@@ -5,6 +5,7 @@ envlist = py36, py37, py38, flake8
basepython = python basepython = python
deps = flake8 deps = flake8
commands = flake8 --ignore=F401,F811,W504 bline commands = flake8 --ignore=F401,F811,W504 bline
flake8 tests
[testenv] [testenv]
commands = python -m unittest 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