Enable py27 and py35 unit testing

This also includes a couple of basic unit tests as proof
that this is working.

Change-Id: Iff8241b4bdfd3c97319198873527911e8ed318e1
This commit is contained in:
Miguel Angel Ajo 2018-03-01 17:14:45 +00:00
parent 5193d0010e
commit e08b086914
8 changed files with 42 additions and 1 deletions

3
.stestr.conf Normal file
View File

@ -0,0 +1,3 @@
[DEFAULT]
test_path=./oslogmerger/tests/unit/
top_dir=./

View File

@ -16,6 +16,10 @@
check: check:
jobs: jobs:
- tox-pep8 - tox-pep8
- tox-py35
- tox-py27
gate: gate:
jobs: jobs:
- tox-pep8 - tox-pep8
- tox-py35
- tox-py27

View File

View File

@ -0,0 +1,8 @@
import mock
from oslotest import base
class BaseTestCase(base.BaseTestCase):
def setUp(self):
super(BaseTestCase, self).setUp()
self.addCleanup(mock.patch.stopall)

View File

View File

@ -0,0 +1,18 @@
from oslogmerger import oslogmerger as om
from oslogmerger.tests import base
class PathManipulationTests(base.BaseTestCase):
def test_get_path_and_alias(self):
self.assertEqual(
om.get_path_and_alias('filename', '/base/', '.log'),
('/base/filename.log', None, False))
self.assertEqual(
om.get_path_and_alias('filename:alias', '/base/', '.log'),
('/base/filename.log', 'alias', False))
def test_get_path_and_alias_http(self):
self.assertEqual(
om.get_path_and_alias('http://server/filename.log', '', ''),
('http://server/filename.log', None, True))

8
tools/ostestr_compat_shim.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# preserve old behavior of using an arg as a regex when '--' is not present
case $@ in
(*--*) ostestr $@;;
('') ostestr;;
(*) ostestr --regex "$@"
esac

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py35,pep8 envlist = py35,py36,py27,pep8
minversion = 2.3.2 minversion = 2.3.2
skipsdist = True skipsdist = True