diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ build/ dist/ .eggs +.tox/ diff --git a/requirements-test.txt b/requirements-test.txt --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1 +1 @@ -nose +pytest diff --git a/swh/loader/tar/tests/test_build.py b/swh/loader/tar/tests/test_build.py --- a/swh/loader/tar/tests/test_build.py +++ b/swh/loader/tar/tests/test_build.py @@ -25,7 +25,7 @@ '/some/root/path/package-foo/package-foo-1.2.3.tgz') # then - self.assertEquals(actual_origin, expected_origin) + self.assertEqual(actual_origin, expected_origin) @patch('swh.loader.tar.build._time_from_path') def test_compute_revision(self, mock_time_from_path): @@ -50,7 +50,7 @@ } # then - self.assertEquals(actual_revision, expected_revision) + self.assertEqual(actual_revision, expected_revision) mock_time_from_path.assert_called_once_with('/some/path') @@ -62,7 +62,7 @@ actual_time = build._time_from_path('some/path') - self.assertEquals(actual_time, { + self.assertEqual(actual_time, { 'seconds': 1445348286, 'microseconds': 8308342 }) @@ -78,7 +78,7 @@ actual_time = build._time_from_path('some/path') - self.assertEquals(actual_time, { + self.assertEqual(actual_time, { 'seconds': 1445348286, 'microseconds': 0 }) diff --git a/swh/loader/tar/tests/test_loader.py b/swh/loader/tar/tests/test_loader.py --- a/swh/loader/tar/tests/test_loader.py +++ b/swh/loader/tar/tests/test_loader.py @@ -127,16 +127,14 @@ actual_revision = self.state('revision')[0] self.assertTrue(actual_revision['synthetic']) - self.assertEquals(actual_revision['parents'], - []) - self.assertEquals(actual_revision['type'], - 'tar') - self.assertEquals(actual_revision['message'], - b'swh-loader-tar: synthetic revision message') - self.assertEquals(actual_revision['directory'], - b'\xa7A\xfcM\x96\x8c{\x8e<\x94\xff\x86\xe7\x04\x80\xc5\xc7\xe5r\xa9') # noqa - - self.assertEquals( + self.assertEqual(actual_revision['parents'], []) + self.assertEqual(actual_revision['type'], 'tar') + self.assertEqual(actual_revision['message'], + b'swh-loader-tar: synthetic revision message') + self.assertEqual(actual_revision['directory'], + b'\xa7A\xfcM\x96\x8c{\x8e<\x94\xff\x86\xe7\x04\x80\xc5\xc7\xe5r\xa9') # noqa + + self.assertEqual( actual_revision['metadata']['original_artifact'][0], { 'sha1_git': 'cc848944a0d3e71d287027347e25467e61b07428', diff --git a/tox.ini b/tox.ini new file mode 100644 --- /dev/null +++ b/tox.ini @@ -0,0 +1,16 @@ +[tox] +envlist=flake8,py3 + +[testenv:py3] +deps = + .[testing] + pytest-cov +commands = + pytest --cov=swh --cov-branch {posargs} + +[testenv:flake8] +skip_install = true +deps = + flake8 +commands = + {envpython} -m flake8