diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ archives/ build/ dist/ +.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/svn/loader.py b/swh/loader/svn/loader.py --- a/swh/loader/svn/loader.py +++ b/swh/loader/svn/loader.py @@ -469,7 +469,7 @@ self.swh_revision_gen = self.process_svn_revisions( self.svnrepo, revision_start, revision_end, revision_parents) except SvnLoaderUneventful as e: - self.log.warn(e) + self.log.warning(e) if self.latest_snapshot and 'snapshot' in self.latest_snapshot: self._snapshot = self.latest_snapshot['snapshot'] self.done = True diff --git a/swh/loader/svn/tests/test_converters.py b/swh/loader/svn/tests/test_converters.py --- a/swh/loader/svn/tests/test_converters.py +++ b/swh/loader/svn/tests/test_converters.py @@ -16,7 +16,7 @@ actual_person = converters.svn_author_to_gitsvn_person( 'tony ', repo_uuid=None) - self.assertEquals(actual_person, { + self.assertEqual(actual_person, { 'fullname': b'tony ', 'name': b'tony', 'email': b'ynot@dagobah', @@ -29,7 +29,7 @@ actual_person = converters.svn_author_to_gitsvn_person( 'tony', repo_uuid=b'some-uuid') - self.assertEquals(actual_person, { + self.assertEqual(actual_person, { 'fullname': b'tony ', 'name': b'tony', 'email': b'tony@some-uuid', @@ -56,7 +56,7 @@ """ actual_person = converters.svn_author_to_swh_person( 'tony ') - self.assertEquals(actual_person, { + self.assertEqual(actual_person, { 'fullname': b'tony ', 'name': b'tony', 'email': b'ynot@dagobah', @@ -67,7 +67,7 @@ """ actual_person = converters.svn_author_to_swh_person('tony') - self.assertEquals(actual_person, { + self.assertEqual(actual_person, { 'fullname': b'tony', 'name': b'tony', 'email': None, @@ -121,7 +121,7 @@ 'offset': 0, } - self.assertEquals(actual_swh_revision, { + self.assertEqual(actual_swh_revision, { 'date': date, 'committer_date': date, 'type': 'svn', @@ -182,7 +182,7 @@ 'offset': 0, } - self.assertEquals(actual_swh_revision, { + self.assertEqual(actual_swh_revision, { 'date': date, 'committer_date': date, 'type': 'svn', @@ -210,7 +210,7 @@ decimals. """ - self.assertEquals( + self.assertEqual( converters.svn_date_to_swh_date('2011-05-31T06:04:39.500900Z'), { 'timestamp': { 'seconds': 1306821879, @@ -219,7 +219,7 @@ 'offset': 0 }) - self.assertEquals( + self.assertEqual( converters.svn_date_to_swh_date('2011-05-31T06:04:39.800722Z'), { 'timestamp': { @@ -232,14 +232,14 @@ def test_svn_date_to_swh_date_epoch(self): """Empty date should be EPOCH (timestamp and offset at 0).""" # It should return 0, epoch - self.assertEquals({ + self.assertEqual({ 'timestamp': { 'seconds': 0, 'microseconds': 0, }, 'offset': 0, }, converters.svn_date_to_swh_date('')) - self.assertEquals({ + self.assertEqual({ 'timestamp': { 'seconds': 0, 'microseconds': 0, @@ -253,7 +253,7 @@ actual_ts = converters.svn_date_to_gitsvn_date( '2011-05-31T06:04:39.800722Z') - self.assertEquals(actual_ts, { + self.assertEqual(actual_ts, { 'timestamp': { 'seconds': 1306821879, 'microseconds': 0, @@ -264,14 +264,14 @@ def test_svn_date_to_gitsvn_date_epoch(self): """Empty date should be EPOCH (timestamp and offset at 0).""" # It should return 0, epoch - self.assertEquals({ + self.assertEqual({ 'timestamp': { 'seconds': 0, 'microseconds': 0, }, 'offset': 0, }, converters.svn_date_to_gitsvn_date('')) - self.assertEquals({ + self.assertEqual({ 'timestamp': { 'seconds': 0, 'microseconds': 0, diff --git a/swh/loader/svn/tests/test_loader.py b/swh/loader/svn/tests/test_loader.py --- a/swh/loader/svn/tests/test_loader.py +++ b/swh/loader/svn/tests/test_loader.py @@ -29,7 +29,7 @@ def test_build_swh_snapshot(self): actual_snap = build_swh_snapshot('revision-id') - self.assertEquals(actual_snap, { + self.assertEqual(actual_snap, { 'id': None, 'branches': { DEFAULT_BRANCH: { @@ -187,7 +187,7 @@ self.assertRevisionsOk(expected_revisions) self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -218,7 +218,7 @@ self.assertCountReleases(0) self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'uneventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -253,7 +253,7 @@ self.assertCountReleases(0) self.assertCountSnapshots(0) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'uneventful'}) self.assertEqual(self.loader.visit_status(), 'partial') @@ -299,7 +299,7 @@ self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -350,7 +350,7 @@ self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -433,7 +433,7 @@ self.assertRevisionsOk(expected_revisions) self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -496,7 +496,7 @@ self.assertRevisionsOk(expected_revisions) self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -596,7 +596,7 @@ self.assertRevisionsOk(expected_revisions) self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -627,7 +627,7 @@ self.assertRevisionsOk(expected_revisions) self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') @@ -660,7 +660,7 @@ self.assertRevisionsOk(expected_revisions) self.assertCountSnapshots(1) # FIXME: Check the snapshot's state - # self.assertEquals(self.loader.all_snapshots[0], {}) + # self.assertEqual(self.loader.all_snapshots[0], {}) self.assertEqual(self.loader.load_status(), {'status': 'eventful'}) self.assertEqual(self.loader.visit_status(), 'full') diff --git a/swh/loader/svn/tests/test_utils.py b/swh/loader/svn/tests/test_utils.py --- a/swh/loader/svn/tests/test_utils.py +++ b/swh/loader/svn/tests/test_utils.py @@ -12,16 +12,16 @@ def test_strdate_to_timestamp(self): """Formatted string date should be converted in timestamp.""" actual_ts = utils.strdate_to_timestamp('2011-05-31T06:04:39.800722Z') - self.assertEquals(actual_ts, {'seconds': 1306821879, - 'microseconds': 800722}) + self.assertEqual(actual_ts, {'seconds': 1306821879, + 'microseconds': 800722}) actual_ts = utils.strdate_to_timestamp('2011-05-31T06:03:39.123450Z') - self.assertEquals(actual_ts, {'seconds': 1306821819, - 'microseconds': 123450}) + self.assertEqual(actual_ts, {'seconds': 1306821819, + 'microseconds': 123450}) def test_strdate_to_timestamp_empty_does_not_break(self): """Empty or None date should be timestamp 0.""" - self.assertEquals({'seconds': 0, 'microseconds': 0}, - utils.strdate_to_timestamp('')) - self.assertEquals({'seconds': 0, 'microseconds': 0}, - utils.strdate_to_timestamp(None)) + self.assertEqual({'seconds': 0, 'microseconds': 0}, + utils.strdate_to_timestamp('')) + self.assertEqual({'seconds': 0, 'microseconds': 0}, + utils.strdate_to_timestamp(None)) 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