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

Merge branch 'unit_tests' into 'master'

Unit tests

See merge request passoft/lopt!7
parents dfbefab0 295d0927
No related branches found
No related tags found
1 merge request!7Unit tests
Pipeline #974 passed with stage
in 1 minute and 13 seconds
......@@ -20,17 +20,35 @@ stages:
before_script:
- pip install -e .[dev]
python2:
image: python:2.7
linting:
image: python:3.6
tags:
- passoft
stage: test
script: tox -e py27
script:
- flake8 lopt
- flake8 tests
python3:
python3.6:
image: python:3.6
tags:
- passoft
stage: test
script: tox -e py36
script:
- python -m unittest
python3.7:
image: python:3.7
tags:
- passoft
stage: test
script:
- python -m unittest
python3.8:
image: python:3.8
tags:
- passoft
stage: test
script:
- python -m unittest
......@@ -4,25 +4,18 @@
"""Tests for `lopt` package."""
import unittest
import sys
try:
import lopt
except ImportError:
pass
from unittest.mock import patch
from lopt.lopt import main
class TestLopt(unittest.TestCase):
"""Tests for `lopt` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"""Tear down test fixtures, if any."""
def test_import(self):
if 'lopt' in sys.modules:
self.assert_(True, "lopt loaded")
else:
self.fail()
"""Test lopt import"""
with patch('sys.argv', ['lopt', '-h']):
with self.assertRaises(SystemExit) as cmd:
main()
self.assertEqual(cmd.exception.code, 0, "sys.exit(0) never called "
"- Failed to exercise lopt")
[tox]
envlist = py27, py36 flake8
[travis]
python =
2.7: py27
3.6: py36
envlist = py36, py37, py38, flake8
[testenv:flake8]
basepython = python
deps = flake8
commands = flake8 lopt
flake8 tests
[testenv]
setenv =
PYTHONPATH = {toxinidir}
commands=python setup.py test
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