also test python 2.7

This commit is contained in:
Edwin Eefting 2020-05-17 22:24:55 +02:00
parent 252086e2e6
commit 87e0599130
8 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,7 @@
language: python language: python
python: python:
- "3.6" - "3.6"
- "2.7"
before_install: before_install:
- sudo apt-get update - sudo apt-get update
- sudo apt-get install zfsutils-linux - sudo apt-get install zfsutils-linux

View File

@ -4,7 +4,7 @@ import subprocess
import random import random
#default test stuff #default test stuff
import unittest import unittest2
import subprocess import subprocess
import time import time
from pprint import * from pprint import *
@ -17,7 +17,7 @@ def shelltest(cmd):
"""execute and print result as nice copypastable string for unit tests (adds extra newlines on top/bottom)""" """execute and print result as nice copypastable string for unit tests (adds extra newlines on top/bottom)"""
ret=(subprocess.check_output(cmd , shell=True).decode('utf-8')) ret=(subprocess.check_output(cmd , shell=True).decode('utf-8'))
print("######### result of: {}".format(cmd)) print("######### result of: {}".format(cmd))
print(ret,end='') print(ret)
print("#########") print("#########")
ret='\n'+ret ret='\n'+ret
return(ret) return(ret)

View File

@ -2,3 +2,4 @@ colorama
argparse argparse
coverage==4.5.4 coverage==4.5.4
python-coveralls python-coveralls
unittest2

View File

@ -16,7 +16,7 @@ if ! [ -e /root/.ssh/id_rsa ]; then
ssh -oStrictHostKeyChecking=no localhost true || exit 1 ssh -oStrictHostKeyChecking=no localhost true || exit 1
fi fi
coverage run --source bin.zfs_autobackup -m unittest -v $@ coverage run --source bin.zfs_autobackup -m unittest -v
EXIT=$? EXIT=$?
echo echo

View File

@ -3,7 +3,7 @@ from basetest import *
print("THIS TEST REQUIRES SSH TO LOCALHOST") print("THIS TEST REQUIRES SSH TO LOCALHOST")
class TestExecuteNode(unittest.TestCase): class TestExecuteNode(unittest2.TestCase):
# def setUp(self): # def setUp(self):

View File

@ -11,11 +11,11 @@ class Thing:
return("{}".format(time.strftime("%Y-%m-%d %H:%M:%S",struct))) return("{}".format(time.strftime("%Y-%m-%d %H:%M:%S",struct)))
class TestThinner(unittest.TestCase): class TestThinner(unittest2.TestCase):
def setUp(self): # def setUp(self):
return super().setUp() # return super().setUp()
def test_incremental(self): def test_incremental(self):
ok=['2023-01-01 10:09:50', ok=['2023-01-01 10:09:50',

View File

@ -1,11 +1,11 @@
from basetest import * from basetest import *
class TestZfsAutobackup(unittest.TestCase): class TestZfsAutobackup(unittest2.TestCase):
def setUp(self): def setUp(self):
prepare_zpools() prepare_zpools()
return super().setUp() # return super(TestZfsAutobackup,self).setUp()
def test_defaults(self): def test_defaults(self):
with self.subTest("defaults with full verbose and debug"): with self.subTest("defaults with full verbose and debug"):

View File

@ -1,11 +1,11 @@
from basetest import * from basetest import *
class TestZfsNode(unittest.TestCase): class TestZfsNode(unittest2.TestCase):
def setUp(self): def setUp(self):
prepare_zpools() prepare_zpools()
return super().setUp() # return super().setUp()
def test_consistent_snapshot(self): def test_consistent_snapshot(self):