Browse Source

Enable py27 and py35 unit testing

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

Change-Id: Iff8241b4bdfd3c97319198873527911e8ed318e1
Miguel Angel Ajo 1 year ago
parent
commit
e08b086914

+ 3
- 0
.stestr.conf View File

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

+ 4
- 0
.zuul.yaml View File

@@ -16,6 +16,10 @@
16 16
     check:
17 17
       jobs:
18 18
         - tox-pep8
19
+        - tox-py35
20
+        - tox-py27
19 21
     gate:
20 22
       jobs:
21 23
         - tox-pep8
24
+        - tox-py35
25
+        - tox-py27

+ 0
- 0
oslogmerger/tests/__init__.py View File


+ 8
- 0
oslogmerger/tests/base.py View File

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

+ 0
- 0
oslogmerger/tests/unit/__init__.py View File


+ 18
- 0
oslogmerger/tests/unit/test_oslogmerger.py View File

@@ -0,0 +1,18 @@
1
+from oslogmerger import oslogmerger as om
2
+from oslogmerger.tests import base
3
+
4
+
5
+class PathManipulationTests(base.BaseTestCase):
6
+    def test_get_path_and_alias(self):
7
+        self.assertEqual(
8
+            om.get_path_and_alias('filename', '/base/', '.log'),
9
+            ('/base/filename.log', None, False))
10
+
11
+        self.assertEqual(
12
+            om.get_path_and_alias('filename:alias', '/base/', '.log'),
13
+            ('/base/filename.log', 'alias', False))
14
+
15
+    def test_get_path_and_alias_http(self):
16
+        self.assertEqual(
17
+            om.get_path_and_alias('http://server/filename.log', '', ''),
18
+            ('http://server/filename.log', None, True))

+ 8
- 0
tools/ostestr_compat_shim.sh View File

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

+ 1
- 1
tox.ini View File

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

Loading…
Cancel
Save