jenkins-bot has submitted this change and it was merged. Change subject: Use relative import of upload in data_ingestion ......................................................................
Use relative import of upload in data_ingestion py3 nosetests fails on 'import upload' in the data_ingestion script, causing a travis build breakage. Two other scripts use 'import upload' - flickrripper - imagetransfer And other use 'import <script>' syntax, which will also fail on py3 nosetests when we have tests for them. This change only updates data_ingestion to use the 'from scripts import upload' import style, to fix the build breakage while waiting on feedback from nosetests https://github.com/nose-devs/nose/issues/839 Also update data_ingestion tests to use the new test metaclass. Change-Id: If40087657718749dd54a37834d551f97424b4914 --- M scripts/data_ingestion.py M tests/data_ingestion_tests.py 2 files changed, 15 insertions(+), 4 deletions(-) Approvals: XZise: Looks good to me, approved jenkins-bot: Verified diff --git a/scripts/data_ingestion.py b/scripts/data_ingestion.py index 83ec1c0..e62ce32 100755 --- a/scripts/data_ingestion.py +++ b/scripts/data_ingestion.py @@ -15,7 +15,10 @@ import sys import pywikibot -import upload +# TODO: nosetests3 fails on 'import <other_script>', which is used by many +# of our scripts, but only data_ingestion is directly imported (not via pwb). +# https://github.com/nose-devs/nose/issues/839 +from scripts import upload if sys.version_info[0] > 2: from urllib.parse import urlparse diff --git a/tests/data_ingestion_tests.py b/tests/data_ingestion_tests.py index 8a877e3..741ccef 100644 --- a/tests/data_ingestion_tests.py +++ b/tests/data_ingestion_tests.py @@ -5,12 +5,16 @@ __version__ = '$Id$' import os -from tests import unittest +from tests.aspects import unittest, TestCase from scripts import data_ingestion -class TestPhoto(unittest.TestCase): +class TestPhoto(TestCase): + + net = True + def setUp(self): + super(TestPhoto, self).setUp() self.obj = data_ingestion.Photo(URL='http://upload.wikimedia.org/wikipedia/commons/f/fc/MP_sounds.png', metadata={'description.en': '"Sounds" icon', 'source': 'http://commons.wikimedia.org/wiki/File:Sound-icon.svg', @@ -43,8 +47,12 @@ }}""") # noqa -class TestCSVReader(unittest.TestCase): +class TestCSVReader(TestCase): + + net = False + def setUp(self): + super(TestCSVReader, self).setUp() fileobj = open(os.path.join(os.path.split(__file__)[0], 'data', 'csv_ingestion.csv')) self.iterator = data_ingestion.CSVReader(fileobj, 'url') self.obj = next(self.iterator) -- To view, visit https://gerrit.wikimedia.org/r/159410 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If40087657718749dd54a37834d551f97424b4914 Gerrit-PatchSet: 2 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg <[email protected]> Gerrit-Reviewer: Ladsgroup <[email protected]> Gerrit-Reviewer: Merlijn van Deen <[email protected]> Gerrit-Reviewer: XZise <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
