From d7265e672035c29b486929caf49d5a9246421d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 15 Nov 2018 23:52:39 +0000 Subject: tests: simplify and cleanup. * Remove the __main__ blocks as the tests should not be executable by themselves. * Use absltest everywhere instead of a mixture of unittest/absltest (via parameterized). * Only modify import path once. * Cleanup pylint warnings, by disabling those that are not useful, and fixing those that are. --- test/test_construct_extras.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'test/test_construct_extras.py') diff --git a/test/test_construct_extras.py b/test/test_construct_extras.py index b0cd1c3..65bc047 100644 --- a/test/test_construct_extras.py +++ b/test/test_construct_extras.py @@ -6,15 +6,13 @@ __email__ = 'flameeyes@flameeyes.eu' __copyright__ = 'Copyright © 2018, Diego Elio Pettenò' __license__ = 'MIT' +# pylint: disable=protected-access,missing-docstring + import datetime -import os -import sys -import unittest +from absl.testing import absltest import construct -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - from glucometerutils.support import construct_extras @@ -24,7 +22,7 @@ _TEST_DATE3 = datetime.datetime(1970, 1, 1, 0, 0) _NEW_EPOCH = 31536000 # datetime.datetime(1971, 1, 1, 0, 0) -class TestTimestamp(unittest.TestCase): +class TestTimestamp(absltest.TestCase): def test_build_unix_epoch(self): self.assertEqual( @@ -69,7 +67,3 @@ class TestTimestamp(unittest.TestCase): def test_invalid_value(self): with self.assertRaises(AssertionError): construct_extras.Timestamp(construct.Int32ul).build('foo') - - -if __name__ == '__main__': - unittest.main() -- cgit v1.2.3