Bug 1556311 - Fix the error "ImportError: no module named ini" while running raptor tests. r=sparky
authorMarian Raiciof <mraiciof@mozilla.com>
Wed, 05 Jun 2019 14:59:16 +0000
changeset 477580 70af85b90c1d4a3f4c75f0fe82ed4a7fd69ce67a
parent 477579 ee9309aacb9e484e128bf55a2fe6c9e6cb63a316
child 477581 d21afff8a5947a80111f4cd53229fb2740c96aae
push id36119
push userncsoregi@mozilla.com
push dateThu, 06 Jun 2019 21:52:09 +0000
treeherdermozilla-central@6a81efd823db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssparky
bugs1556311
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1556311 - Fix the error "ImportError: no module named ini" while running raptor tests. r=sparky Differential Revision: https://phabricator.services.mozilla.com/D33457
testing/raptor/raptor/raptor.py
testing/raptor/raptor/utils.py
testing/raptor/test/conftest.py
testing/raptor/test/test_manifest.py
testing/raptor/test/test_raptor.py
testing/raptor/test/test_utils.py
--- a/testing/raptor/raptor/raptor.py
+++ b/testing/raptor/raptor/raptor.py
@@ -23,22 +23,16 @@ from mozdevice import ADBDevice
 from mozlog import commandline, get_default_logger
 from mozprofile import create_profile
 from mozproxy import get_playback
 from mozrunner import runners
 
 # need this so raptor imports work both from /raptor and via mach
 here = os.path.abspath(os.path.dirname(__file__))
 paths = [here]
-if os.environ.get('SCRIPTSPATH') is not None:
-    # in production it is env SCRIPTS_PATH
-    paths.append(os.environ['SCRIPTSPATH'])
-else:
-    # locally it's in source tree
-    paths.append(os.path.join(here, '..', '..', 'mozharness'))
 
 webext_dir = os.path.join(here, '..', 'webext')
 paths.append(webext_dir)
 
 for path in paths:
     if not os.path.exists(path):
         raise IOError("%s does not exist. " % path)
     sys.path.insert(0, path)
--- a/testing/raptor/raptor/utils.py
+++ b/testing/raptor/raptor/utils.py
@@ -10,32 +10,21 @@ import subprocess
 import sys
 import time
 
 from mozlog import get_proxy_logger, get_default_logger
 
 LOG = get_proxy_logger(component="raptor-utils")
 here = os.path.dirname(os.path.realpath(__file__))
 
-if os.environ.get('SCRIPTSPATH', None) is not None:
-    # in production it is env SCRIPTS_PATH
-    mozharness_dir = os.environ['SCRIPTSPATH']
-else:
-    # locally it's in source tree
-    mozharness_dir = os.path.join(here, '../../mozharness')
-sys.path.insert(0, mozharness_dir)
-
 external_tools_path = os.environ.get('EXTERNALTOOLSPATH', None)
 
 if external_tools_path is not None:
     # running in production via mozharness
     TOOLTOOL_PATH = os.path.join(external_tools_path, 'tooltool.py')
-else:
-    # running locally via mach
-    TOOLTOOL_PATH = os.path.join(mozharness_dir, 'external_tools', 'tooltool.py')
 
 
 def transform_platform(str_to_transform, config_platform, config_processor=None):
     """Transform platform name i.e. 'mitmproxy-rel-bin-{platform}.manifest'
     transforms to 'mitmproxy-rel-bin-osx.manifest'.
     Also transform '{x64}' if needed for 64 bit / win 10"""
     if '{platform}' not in str_to_transform and '{x64}' not in str_to_transform:
         return str_to_transform
--- a/testing/raptor/test/conftest.py
+++ b/testing/raptor/test/conftest.py
@@ -1,27 +1,19 @@
 from __future__ import absolute_import
 
 import json
 import os
-import sys
 
 import pytest
 
 from argparse import Namespace
 
 # need this so raptor imports work both from /raptor and via mach
 here = os.path.abspath(os.path.dirname(__file__))
-if os.environ.get('SCRIPTSPATH') is not None:
-    # in production it is env SCRIPTS_PATH
-    mozharness_dir = os.environ['SCRIPTSPATH']
-else:
-    # locally it's in source tree
-    mozharness_dir = os.path.join(here, '../../mozharness')
-sys.path.insert(0, mozharness_dir)
 
 from raptor.raptor import RaptorDesktopFirefox
 
 
 @pytest.fixture(scope='function')
 def options(request):
     opts = {
         'app': 'firefox',
--- a/testing/raptor/test/test_manifest.py
+++ b/testing/raptor/test/test_manifest.py
@@ -3,23 +3,16 @@ from __future__ import absolute_import, 
 import mozinfo
 import mozunit
 import os
 import pytest
 import sys
 
 # need this so raptor imports work both from /raptor and via mach
 here = os.path.abspath(os.path.dirname(__file__))
-if os.environ.get('SCRIPTSPATH', None) is not None:
-    # in production it is env SCRIPTS_PATH
-    mozharness_dir = os.environ['SCRIPTSPATH']
-else:
-    # locally it's in source tree
-    mozharness_dir = os.path.join(here, '../../mozharness')
-sys.path.insert(1, mozharness_dir)
 
 raptor_dir = os.path.join(os.path.dirname(here), 'raptor')
 sys.path.insert(0, raptor_dir)
 
 from manifest import get_browser_test_list, validate_test_ini, get_raptor_test_list
 
 
 # some test details (test INIs)
--- a/testing/raptor/test/test_raptor.py
+++ b/testing/raptor/test/test_raptor.py
@@ -9,23 +9,16 @@ import time
 import mozunit
 import pytest
 
 from mozprofile import BaseProfile
 from mozrunner.errors import RunnerNotStartedError
 
 # need this so raptor imports work both from /raptor and via mach
 here = os.path.abspath(os.path.dirname(__file__))
-if os.environ.get('SCRIPTSPATH', None) is not None:
-    # in production it is env SCRIPTS_PATH
-    mozharness_dir = os.environ['SCRIPTSPATH']
-else:
-    # locally it's in source tree
-    mozharness_dir = os.path.join(here, '../../mozharness')
-sys.path.insert(0, mozharness_dir)
 
 from raptor.raptor import RaptorDesktopFirefox, RaptorDesktopChrome, RaptorAndroid
 
 
 class TestBrowserThread(threading.Thread):
         def __init__(self, raptor_instance, tests, names):
             super(TestBrowserThread, self).__init__()
             self.raptor_instance = raptor_instance
--- a/testing/raptor/test/test_utils.py
+++ b/testing/raptor/test/test_utils.py
@@ -2,23 +2,16 @@ from __future__ import absolute_import, 
 
 import mozunit
 import os
 import pytest
 import sys
 
 # need this so raptor imports work both from /raptor and via mach
 here = os.path.abspath(os.path.dirname(__file__))
-if os.environ.get('SCRIPTSPATH', None) is not None:
-    # in production it is env SCRIPTS_PATH
-    mozharness_dir = os.environ['SCRIPTSPATH']
-else:
-    # locally it's in source tree
-    mozharness_dir = os.path.join(here, '../../mozharness')
-sys.path.insert(1, mozharness_dir)
 
 raptor_dir = os.path.join(os.path.dirname(here), 'raptor')
 sys.path.insert(0, raptor_dir)
 
 from utils import transform_platform
 
 
 @pytest.mark.parametrize('platform', ['win', 'mac', 'linux64'])