From a8287fbdee4a75f1a8bd54f0c9072bc637242e03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Ollivier?= Date: Fri, 26 Jul 2019 12:58:04 +0200 Subject: [PATCH] Enable py36 unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It benefits from the swith to lf-virtual1. Change-Id: I9f99f24a5e3c8ef6374e049d7117aa7d5aa4d442 Signed-off-by: Cédric Ollivier --- .travis.yml | 2 +- test-requirements.txt | 2 +- tox.ini | 2 +- upper-constraints.txt | 2 ++ xtesting/tests/unit/core/test_feature.py | 1 + xtesting/tests/unit/core/test_testcase.py | 1 + xtesting/tests/unit/energy/test_functest_energy.py | 14 +++++++------- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1ffc4c29..72524825 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ language: generic before_script: - sudo apt-get -y install qemu-user-static - - sudo add-apt-repository -y ppa:jonathonf/python-3.6 + - sudo add-apt-repository -y ppa:deadsnakes/ppa - sudo apt-get update - sudo apt-get install python3.6 python3.6-dev - sudo pip install tox diff --git a/test-requirements.txt b/test-requirements.txt index 08f08077..ef2ef201 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,7 @@ coverage!=4.4 # Apache-2.0 mock # BSD nose # LGPL flake8<2.6.0,>=2.5.4 # MIT -pylint==1.4.5 # GPLv2 +pylint # GPLv2 sphinx!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7;python_version>='3.4' # BSD sphinx-rtd-theme diff --git a/tox.ini b/tox.ini index 1dedf986..2249a59c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = docs,pep8,pylint,yamllint,ansiblelint,bashate,py27,perm,cover +envlist = docs,pep8,pylint,yamllint,ansiblelint,bashate,py27,py36,cover skipsdist = True [testenv] diff --git a/upper-constraints.txt b/upper-constraints.txt index 3bfdf036..1e03562c 100644 --- a/upper-constraints.txt +++ b/upper-constraints.txt @@ -1,2 +1,4 @@ robotframework===3.0.2 bandit===1.1.0 +pylint===1.9.5;python_version=='2.7' +pylint===2.3.1;python_version=='3.6' diff --git a/xtesting/tests/unit/core/test_feature.py b/xtesting/tests/unit/core/test_feature.py index 30678798..785f6e16 100644 --- a/xtesting/tests/unit/core/test_feature.py +++ b/xtesting/tests/unit/core/test_feature.py @@ -29,6 +29,7 @@ class FakeTestCase(feature.Feature): class AbstractFeatureTesting(unittest.TestCase): def test_run_unimplemented(self): + # pylint: disable=abstract-class-instantiated with self.assertRaises(TypeError): feature.Feature(case_name="feature", project_name="xtesting") diff --git a/xtesting/tests/unit/core/test_testcase.py b/xtesting/tests/unit/core/test_testcase.py index 51ea6f35..fc612973 100644 --- a/xtesting/tests/unit/core/test_testcase.py +++ b/xtesting/tests/unit/core/test_testcase.py @@ -35,6 +35,7 @@ class FakeTestCase(testcase.TestCase): class AbstractTestCaseTesting(unittest.TestCase): def test_run_unimplemented(self): + # pylint: disable=abstract-class-instantiated with self.assertRaises(TypeError): testcase.TestCase(case_name="base", project_name="xtesting") diff --git a/xtesting/tests/unit/energy/test_functest_energy.py b/xtesting/tests/unit/energy/test_functest_energy.py index ea83c1ea..826e0d99 100644 --- a/xtesting/tests/unit/energy/test_functest_energy.py +++ b/xtesting/tests/unit/energy/test_functest_energy.py @@ -287,11 +287,11 @@ class EnergyRecorderTest(unittest.TestCase): EnergyRecorder.energy_recorder_api = None EnergyRecorder.load_config() - self.assertEquals( + self.assertEqual( EnergyRecorder.energy_recorder_api["auth"], ("user", "password") ) - self.assertEquals( + self.assertEqual( EnergyRecorder.energy_recorder_api["uri"], "http://pod-uri:8888/recorders/environment/MOCK_POD" ) @@ -304,8 +304,8 @@ class EnergyRecorderTest(unittest.TestCase): self._set_env_nocreds() EnergyRecorder.energy_recorder_api = None EnergyRecorder.load_config() - self.assertEquals(EnergyRecorder.energy_recorder_api["auth"], None) - self.assertEquals( + self.assertEqual(EnergyRecorder.energy_recorder_api["auth"], None) + self.assertEqual( EnergyRecorder.energy_recorder_api["uri"], "http://pod-uri:8888/recorders/environment/MOCK_POD" ) @@ -319,7 +319,7 @@ class EnergyRecorderTest(unittest.TestCase): with self.assertRaises(AssertionError): EnergyRecorder.energy_recorder_api = None EnergyRecorder.load_config() - self.assertEquals(EnergyRecorder.energy_recorder_api, None) + self.assertEqual(EnergyRecorder.energy_recorder_api, None) @mock.patch("xtesting.energy.energy.requests.get", return_value=API_KO) @@ -329,8 +329,8 @@ class EnergyRecorderTest(unittest.TestCase): self._set_env_creds() EnergyRecorder.energy_recorder_api = None EnergyRecorder.load_config() - self.assertEquals(EnergyRecorder.energy_recorder_api["available"], - False) + self.assertEqual(EnergyRecorder.energy_recorder_api["available"], + False) @mock.patch('xtesting.energy.energy.requests.get', return_value=RECORDER_OK) -- 2.16.6